November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Multiple IP Addresses on the same physical connection (Linux)

 

There are times when a server can be allocated more than one IP Address even though it contains only one physical network card. To associate these IP addresses with the server some manipulation of networking settings will need to be performed. The steps outlined in this walk-through are for RedHat based systems. This tutorial is for statically assigned IP Addresses (as a server generally will have).
For this walk through we are going to add one additional IP address to eth0. Navigate to

cd /etc/sysconfig/network-scripts

Copy ifcfg-eth0 to ifcfg-eth0:0

cp ifcfg-eth0 ifcfg-eth0:0

Now we need to modify the new file slightly so that it gets it’s own IP address.

nano ifcfg-eth0:0

DEVICE=eth0:0     <— Change this to match the new eth0:0 file we just created
BOOTPROTO=none
BROADCAST=x.x.x.x    <— This is the broad cast address for the subnet the new IP is on
DNS1=x.x.x.x    <— This is the main DNS server you are using (example: 64.120.14.26)
GATEWAY=x.x.x.x   <— This is the gateway address for the subnet the new IP is on
HWADDR=<DO NOT CHANGE>   <— Don’t change this from what is existing. The Hardware address is the same as the physical one
IPADDR=x.x.x.x   <— This is your new IP address
NETMASK=x.x.x.x   <— This is the netmask for the subnet the new IP is on
ONBOOT=yes    <— Leave to yes
OPTIONS=layer2=1
TYPE=Ethernet
PREFIX=29
DEFROUTE=yes
NAME=”System eth0:0?    <— Change to reflect new name of device
[/code]

Save your file with the new settings. Now we need to restart the networking service:

service network restart

When the network components come back up you should see your new device in the ifconfig command.To add more IPs, copy and replace values as specified above.

1 comment to Multiple IP Addresses on the same physical connection (Linux)

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>