LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Setting up dual IP's one NIC (https://www.linuxquestions.org/questions/linux-networking-3/setting-up-dual-ips-one-nic-1771/)

INS 04-10-2001 07:57 PM

I am running RH7.0 server. I have recently gotten a range of static IP's. I need to configure my RH box to work in my existing network, but also need it to work w/ one of the static IP's.

Things were running fine, until I got the static IP's and my default gateway changed from 10.1.2.1 to 63.230.123.214. I have seen posts that a NIC can have 2 IP's in Linux (heck it was easy for me on NT) but being new to Linux I am lost. I have tried multiple "settings" in linuxconf, but none really work as needed.

With it's original ip (10.1.1.2) my internal network "sees" the system fine, but mail won't transfer to the outside world and the web does not work either. If I change the IP to the external one, the web works but then my local systems can't find the mail server to send mail.

Help! Please.... I don't mind reading so even a link would help, which I will be looking for next.

Thank you any and all in advance,
INS aka Henry

INS 04-10-2001 10:12 PM

found it
 
I did find the answer on a RedHat discussion form. But for those of you woundering the same thing here is what I found:

[SNIP]

It is actually just about as easy as it is in NT. It is called IP aliasing, and Red Hat compiles it into their kernels. It works almost the same as a normal interface *except* the statistics are for the physical card, not each individual IP address. So if I wanted to setup an IP alias on eth0 I would create a file:

/etc/sysconfig/network-scripts/ifcfg-eth0:0

And that file might look something like this:

DEVICE=eth0:0
BOOTPROTO=none
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
GATEWAY=192.168.0.254
USERCTL=no

Then restart your networking (/etc/rc.d/init.d/network restart). IP aliasing is entirely virtual, so no modules need to be loaded or anything like that (although the ip_alias code can be compiled as a module and loaded that way as well). You can check the interface like this:

ifconfig eth0:0

and it will report the setup of the interface. Once you're done with that and the IP address is working properly, you can set up the IP-based virtual hosting in httpd.conf.

[SNIP]

I forgot to add:

ONBOOT=yes

to the above configuration.



The only change I made to the above instructions was that I setup the external IP as the "main" IP of the system and setup the alias (eth0:0) to be my internal. I don't think I had to, but it works. That is all that matters right????
OK, I will probably double chek that later to find out for sure.

The actual web link is:
https://www.redhat.com/WebX?13@67.Ky...N^1@.ee6c672/0

Thanx again,
INS

crnaik 01-28-2004 05:18 AM

Is anything more need????
 
I have also tried with the same but it is not working at my side. Is anything more needed to configure two IP addresses on a single NIC???

Though I am setting up one internal and one external IP address.

Thank You


All times are GMT -5. The time now is 01:52 PM.