{"id":546,"date":"2012-07-10T10:53:56","date_gmt":"2012-07-10T02:53:56","guid":{"rendered":"http:\/\/rmohan.com\/?p=546"},"modified":"2012-08-29T12:15:22","modified_gmt":"2012-08-29T04:15:22","slug":"multiple-ip-addresses-on-the-same-physical-connection-linux","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=546","title":{"rendered":"Multiple IP Addresses on the same physical connection (Linux)"},"content":{"rendered":"<p>&nbsp;<\/p>\n<div>\n<p>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).<br \/> For this walk through we are going to add one additional IP address to eth0. Navigate to<\/p>\n<div>\n<div id=\"highlighter_119664\">\n<div><a href=\"http:\/\/www.syntaxtechnology.com\/2010\/11\/multiple-ip-addresses-on-the-same-physical-connection-linux\/#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>cd \/etc\/sysconfig\/network-scripts<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Copy ifcfg-eth0 to ifcfg-eth0:0<\/p>\n<div>\n<div id=\"highlighter_689303\">\n<div><a href=\"http:\/\/www.syntaxtechnology.com\/2010\/11\/multiple-ip-addresses-on-the-same-physical-connection-linux\/#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>cp ifcfg-eth0 ifcfg-eth0:0<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Now we need to modify the new file slightly so that it gets it\u2019s own IP address.<\/p>\n<div>\n<div id=\"highlighter_384552\">\n<div><a href=\"http:\/\/www.syntaxtechnology.com\/2010\/11\/multiple-ip-addresses-on-the-same-physical-connection-linux\/#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>nano ifcfg-eth0:0<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>DEVICE=eth0:0\u00a0\u00a0\u00a0\u00a0 &lt;\u2014 Change this to match the new eth0:0 file we just created<br \/> BOOTPROTO=none<br \/> BROADCAST=x.x.x.x\u00a0\u00a0\u00a0 &lt;\u2014 This is the broad cast address for the subnet the new IP is on<br \/> DNS1=x.x.x.x\u00a0\u00a0\u00a0 &lt;\u2014 This is the main DNS server you are using (example: 64.120.14.26)<br \/> GATEWAY=x.x.x.x\u00a0\u00a0 &lt;\u2014 This is the gateway address for the subnet the new IP is on<br \/> HWADDR=&lt;DO NOT CHANGE&gt;\u00a0\u00a0 &lt;\u2014 Don\u2019t change this from what is existing. The Hardware address is the same as the physical one<br \/> IPADDR=x.x.x.x\u00a0\u00a0 &lt;\u2014 This is your new IP address<br \/> NETMASK=x.x.x.x\u00a0\u00a0 &lt;\u2014 This is the netmask for the subnet the new IP is on<br \/> ONBOOT=yes\u00a0\u00a0\u00a0 &lt;\u2014 Leave to yes<br \/> OPTIONS=layer2=1<br \/> TYPE=Ethernet<br \/> PREFIX=29<br \/> DEFROUTE=yes<br \/> NAME=\u201dSystem eth0:0?\u00a0\u00a0\u00a0 &lt;\u2014 Change to reflect new name of device<br \/> [\/code]<\/p>\n<p>Save your file with the new settings. Now we need to restart the networking service:<\/p>\n<div>\n<div id=\"highlighter_995025\">\n<div><a href=\"http:\/\/www.syntaxtechnology.com\/2010\/11\/multiple-ip-addresses-on-the-same-physical-connection-linux\/#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>service network restart<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>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.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;<\/p>\n<p>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 [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/546"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=546"}],"version-history":[{"count":3,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/546\/revisions"}],"predecessor-version":[{"id":1219,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/546\/revisions\/1219"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}