1

I have a /26 static ip in my network and I want to assign a second ip to a machine which already have one ip on eth0. The OS CentOS 6.6 64bit.

I added another ethernet adapter (card) to the machine and removed the 70-persistent-net.rules so network cards can be detected and added automatically after reboot. Rebooted the OS and ran ifup eth1:

root@host [~]# ifup eth1 /sbin/ifup: configuration for eth1 not found. Usage: ifup

So I made a copy of ifcfg-eth0 to ifcfg-eth1 and replaces eth0 to eth1 and hardware id (mac).

Content of ifcfg-eth1:

HWADDR=00:50:56:be:57:c2
NAME=eth1
GATEWAY=xxx.xxx.xxx.1
DNS1=8.8.8.8
DNS2=8.8.4.4
DOMAIN=Google.com
DEVICE=eth1
ONBOOT=yes
USERCTL=no
BOOTPROTO=static
NETMASK=255.255.255.192
IPADDR=xxx.xxx.xxx.5
PEERDNS=no
IPV6INIT=no

check_link_down() {
 return 1;
}

Content of ifcfg-eth0:

HWADDR=00:50:56:be:7b:88
NAME=eth0
GATEWAY=81.17.30.1
DNS1=8.8.8.8
DNS2=8.8.4.4
DOMAIN=Google.com
DEVICE=eth0
ONBOOT=yes
USERCTL=no
BOOTPROTO=static
NETMASK=255.255.255.192
IPADDR=81.17.30.37
PEERDNS=no
IPV6INIT=no

check_link_down() {
 return 1;
}

and ran service network restart:

Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address xxx.xxx.xxx.37 is already in use for device eth0...
                                                           [  OK  ]
Bringing up interface eth1:  Determining if ip address xxx.xxx.xxx.5 is already in use for device eth1...
                                                           [  OK  ]

xxx.xxx.xxx.37 is still up but xxx.xxx.xxx.5 is not responding. Did I do anything wrong?

2 Answers 2

0

I would start by putting back 70-persistent-net.rules and removing ifcfg-eth1. Boot the system. Add or edit ifcfg-eth1. Restart networking.

You need the dns settings only once. If the gateway definition defines the default gateway then you must have at most one of them.

1
  • Did not work! Everything seems normal if you check my answer below.
    – Amin
    Aug 8, 2015 at 15:24
0

I removed 70-persistent-net.rules and 70-persistent-cd.rules and ifcfg-eth1 configuration file and reset the machine. then created ifcfg-eth1 file and replaced mac, ips and eth0 txt and reset the network, now ifconfig shows:

eth0      Link encap:Ethernet  HWaddr 00:50:56:BE:7B:88
          inet addr:xx.xx.xx.37  Bcast:xx.xx.xx.63  Mask:255.255.255.192
          inet6 addr: fe80::250:56ff:febe:7b88/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:194 errors:0 dropped:0 overruns:0 frame:0
          TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:13246 (12.9 KiB)  TX bytes:9120 (8.9 KiB)

eth1      Link encap:Ethernet  HWaddr 00:50:56:BE:57:C2
          inet addr:xx.xx.xx.50  Bcast:xx.xx.xx.63  Mask:255.255.255.192
          inet6 addr: fe80::250:56ff:febe:57c2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:104 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6548 (6.3 KiB)  TX bytes:580 (580.0 b)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:394 errors:0 dropped:0 overruns:0 frame:0
          TX packets:394 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:61103 (59.6 KiB)  TX bytes:61103 (59.6 KiB)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .