interface mapping two IPs on ubuntu 6.06 lts server
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
interface mapping two IPs on ubuntu 6.06 lts server
Hello,
Im still pretty new to linux and i'm using ubuntu's server 6.06 lts dapper drake distribution to try to figure things out.
upon installing the ssl module for apache, i realized i need to setup virtual host so i can have http and https. i would prefer to have two separate IPs on eth0 rather than installing another NIC, but the manual pages interfaces(5) for the /etc/network/interfaces file is a little over my head.
"The first line of a mapping stanza consists of the word "mapping" followed by a pattern in shell glob syntax. Each mapping stanza must contain a script definition. The named script is run... See /usr/share/doc/ifupdown/examples of what the script must print."
i checked out a few of those examples, but i guess i didn't really understand what they were saying.
questions:
1) is this a bit over my head, and if so;
2) how do i do it?
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700
Rep:
Not sure if Ubuntu does it but in Redhat / Fedora distros you use IP Aliasing. You make the other IP eth0:0 and the next eth0:1 and so on. But if you are using iptables for port forwarding then you need to use the IP and not eth0:0 notations. Iptables does not understand IP Aliasing.
worked fine when the server was up and running (both IPs were pingable, my ip-based virtual hosts for apache worked perfectly) but when i edited my /etc/network/interfaces to
every time i try to boot, it hangs at "configuring network interfaces" and sits there indefinitely (a few days justifies 'indefinitely') i realize that this is probably a simple syntax error on my part, but i can no longer boot to fix the problem. i downloaded knoppix to try to edit the file, but it tells me something along the lines of "read only filesystem"...
i'll take suggestions concerning the syntax of the interfaces file and/or ways to boot (with either ubuntu, knoppix, or another alternative) so that i can actually apply those suggestions.
please and thanks again,
Jeff
Last edited by elgranjefe; 10-02-2007 at 06:18 PM.
You shall not assign dynamic ip address to webserver.
Anyway, if you want to correct the thing just log in as single user,
during boot from GRUB, choose your Linux as boot OS, press 'e', at 2nd line, press 'e' again.
Go to end of the line, type 'single', then press enter and 'b'.
Now you login to single user mode, without network, without GUI and anything. Perform the correction and then type this command:- /sbin/init 2
It still tries to configure my network interfaces and hangs...
to clarify that I'm doing things right... please correct me if I'm wrong.
At the main GRUB menu, I highlight the OS I want (Ubuntu, kernel 2.6.15-26-sever), then press 'e'.
Next, I press 'e' again with "root (hd0,0)" selected, append 'single' to the end of the line, press enter to accept the change. Then press 'b' to boot.
i figured out how to use the ubuntu install cd as to log in as root and edit the interfaces file!
the only way i could get the system to boot was with
Code:
...
# default interface
auto eth0:0
iface eth0:0 inet static
address 192.168.1.4
netmask 255.255.255.0
gateway 192.168.1.1
# second IP for SSL
auto eth0:1
iface eth0:1 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1
the only problem is that ifconfig reports eth0:0/1 as being inactive. i used ifconfig eth0:0/1 up with no errors and i can ping each ip on the server itself, but other macines time out when trying to ping.
any suggestions...?
thanks again,
jeff
Last edited by elgranjefe; 10-02-2007 at 06:20 PM.
i can't believe it took me so long to realize that all i needed to do was hit 'enter' when it hangs on "configuring network interfaces" and it continues to boot successfully.
so i configured the interfaces file as follows
Code:
auto lo
iface lo inet loopback
# default interface
auto eth0
iface eth0 inet static
address 192.168.1.4
netmask 255.255.255.0
gateway 192.168.1.1
# second IP for SSL
auto eth0:0
iface eth0:0 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1
both eth0 and eth0:0 work how i intended, and i don't have any problems except the fact that its annoying having to be on-site and physically press enter on each reboot.
does anyone know how to remedy that?
Last edited by elgranjefe; 10-05-2007 at 05:09 PM.
just in case anyone does read this, i finally and completely eliminated the problem by only having eth0 boot at startup.
to automatically setup my virtual interfaces, i created a php-cli script (i didn't want to take the time to learn bash programming) that configures virtual interfaces based on settings in the config file. thenm i created a cron job to run the php script at startup.
may not be the most professional approach, but its gets the job done for me
Another option is to skip the virtual interfaces and just add a second IP to the adapter directly using ip addr add xxx.xxx.xxx.xxx/xx dev /eth0. ifconfig has been deprecated in kernels after 2.4 in favor of iproute2. I believe the startup issue that you are seeing is that in linux the virtual interfaces are not a true interface, but simply an alias.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.