LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 09-19-2007, 08:10 PM   #1
elgranjefe
LQ Newbie
 
Registered: Apr 2006
Location: Silverton, OR
Distribution: Ubuntu 8.04 server / destktop
Posts: 8

Rep: Reputation: 0
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?

thanks
 
Old 09-19-2007, 09:31 PM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
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: Reputation: 61
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.

Brian
 
Old 09-19-2007, 09:34 PM   #3
kstan
Member
 
Registered: Sep 2004
Location: Malaysia, Johor
Distribution: Dual boot MacOS X/Ubuntu 9.10
Posts: 851

Rep: Reputation: 31
Hi elgranjefe,
if you want to have more ipaddress from eth0, run following command(eth0:0 is default).

ifconfig eth0:1
ifconfig eth0:2
Regards,
Ks

Last edited by kstan; 09-19-2007 at 09:37 PM. Reason: seems like I'm misunderstand the problem.
 
Old 10-01-2007, 04:07 AM   #4
elgranjefe
LQ Newbie
 
Registered: Apr 2006
Location: Silverton, OR
Distribution: Ubuntu 8.04 server / destktop
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kstan View Post
Hi elgranjefe,
if you want to have more ipaddress from eth0, run following command(eth0:0 is default).

ifconfig eth0:1
ifconfig eth0:2
Regards,
Ks
First off, sorry about the wait as i've been busy with life and configuring my ubuntu server is more of a leisure activity at this point...

anyhoo... using

Code:
ifconfig eth0:0 192.168.1.4
ifconfig eth0:1 192.168.1.3
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

Code:
...
auto eth0
iface eth0 inet static
     address 192.168.1.4
     netmask 255.255.255.0
     gateway 192.168.1.1

auto eth0:1
iface eth0:1 inet static
     address 192.168.1.3
     netmask 255.255.255.0
     gateway 192.168.1.1
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 07:18 PM.
 
Old 10-01-2007, 04:28 AM   #5
kstan
Member
 
Registered: Sep 2004
Location: Malaysia, Johor
Distribution: Dual boot MacOS X/Ubuntu 9.10
Posts: 851

Rep: Reputation: 31
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
 
Old 10-01-2007, 05:11 AM   #6
elgranjefe
LQ Newbie
 
Registered: Apr 2006
Location: Silverton, OR
Distribution: Ubuntu 8.04 server / destktop
Posts: 8

Original Poster
Rep: Reputation: 0
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.
 
Old 10-02-2007, 06:42 PM   #7
elgranjefe
LQ Newbie
 
Registered: Apr 2006
Location: Silverton, OR
Distribution: Ubuntu 8.04 server / destktop
Posts: 8

Original Poster
Rep: Reputation: 0
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 07:20 PM.
 
Old 10-05-2007, 06:03 PM   #8
elgranjefe
LQ Newbie
 
Registered: Apr 2006
Location: Silverton, OR
Distribution: Ubuntu 8.04 server / destktop
Posts: 8

Original Poster
Rep: Reputation: 0
haha

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 06:09 PM.
 
Old 11-12-2007, 06:24 PM   #9
elgranjefe
LQ Newbie
 
Registered: Apr 2006
Location: Silverton, OR
Distribution: Ubuntu 8.04 server / destktop
Posts: 8

Original Poster
Rep: Reputation: 0
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
 
Old 11-12-2007, 09:09 PM   #10
javaroast
Member
 
Registered: Apr 2005
Posts: 130

Rep: Reputation: 18
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: vtiger CRM 5.02 on Ubuntu 6.06 LTS Server (Dapper Drake) LXer Syndicated Linux News 0 03-05-2007 06:46 AM
HOWTO--The Perfect Setup - Ubuntu 6.06 LTS Server (Dapper Drake) pigswillfly Ubuntu 5 12-19-2006 08:26 AM
LXer: How To Install VMware Server On Ubuntu 6.06 LTS (Dapper Drake) LXer Syndicated Linux News 0 07-16-2006 08:33 PM
LXer: Announcing Ubuntu 6.06 LTS server for SUN Sparc64 LXer Syndicated Linux News 0 06-17-2006 01:21 AM
LXer: How To Build A LAMP Server With Ubuntu 6.06 LTS LXer Syndicated Linux News 1 06-06-2006 10:25 AM


All times are GMT -5. The time now is 12:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration