cancel
Showing results for 
Search instead for 
Did you mean: 

multiple IPs

Imran Hussain
Occasional Contributor

multiple IPs

hello

i want to enter multiple IPs on my RH 8.0 box. how can i do this.
2 REPLIES
Michael Steele_2
Honored Contributor

Re: multiple IPs

2 ip's will require 2 NIC's or use 'ip alias' and have one static and one dynamic ip:

http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/ref-guide/s1-networkscripts-interfaces.html

"...For example, a ifcfg-eth0:0 file could be configured to specify DEVICE=eth0:0 and a static IP address of 10.0.0.2, serving as an alias of an Ethernet interface already configured to receive its IP information via DHCP in ifcfg-eth0. At that point, the eth0 device is bound to a dynamic IP address, but it can always be referred to on that system via the fixed 10.0.0.2 IP address....
Support Fatherhood - Stop Family Law
Bill Douglass
Esteemed Contributor

Re: multiple IPs

You can define multiple "alias" interfaces on an existing interface. The syntax is:

ifconfig if:# netmask up

if is your network interface, such as eth0
# is the number opf the alias interface.

For example, on my machine:

# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:B0:D0:D0:E8:47
inet addr:10.241.16.48 Bcast:10.241.23.255 Mask:255.255.248.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:79136822 errors:0 dropped:0 overruns:0 frame:0
TX packets:53045536 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:3511096708 (3348.4 Mb) TX bytes:385305413 (367.4 Mb)
Interrupt:11 Base address:0xc000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1344229 errors:0 dropped:0 overruns:0 frame:0
TX packets:1344229 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:288508286 (275.1 Mb) TX bytes:288508286 (275.1 Mb)


I then perform (as root):

# ifconfig eth0:0 10.241.16.43 -netmask 255.255.248.0 up

Now I get:

@ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:B0:D0:D0:E8:47
inet addr:10.241.16.48 Bcast:10.241.23.255 Mask:255.255.248.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:79138493 errors:0 dropped:0 overruns:0 frame:0
TX packets:53045921 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:3511592780 (3348.9 Mb) TX bytes:385379371 (367.5 Mb)
Interrupt:11 Base address:0xc000

eth0:0 Link encap:Ethernet HWaddr 00:B0:D0:D0:E8:47
inet addr:10.241.16.43 Bcast:10.255.255.255 Mask:255.255.248.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:11 Base address:0xc000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1345176 errors:0 dropped:0 overruns:0 frame:0
TX packets:1345176 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:288605666 (275.2 Mb) TX bytes:288605666 (275.2 Mb)


You can assign aliases to both statically- and dhcp-defined interfaces.

You can use /usr/sbin/neat (also known as redhat-config-network) to assign an alias to an existing interface. It provides a GUI for doing the above, and write the results to /etc/sysconfig/network-scripts/ifcfg-eth0:0, so your alias interface will be established every time you reboot.