Two interfaces do not work at the same time

ramil1994

New Member
Credits
30
Hello!
I have one main interface eth0 and I added a second additional eth0:1 In the second I just put the ip and mask without a gateway. But when raising ifup eth0:1 İt is up but the main interface eth0 turns off and vice versa.
Removing /etc/udev/rules.d/70-persistent-net.rules and restarting tried, didn't help
 


dos2unix

Well-Known Member
Credits
4,105
Is your real, and virtual interfaces both on the same subnet? I'm assuming since
there is only one physical interface, there is only one router/switch?

How do you go through this router without a gateway?
 

ramil1994

New Member
Credits
30
yes there is only one physical interface. And it always works. and an additional one is needed just in order to send a ping to it from another address

İcma Tərəfindən Doğrulanmış ikonası
 

drkillpatient

New Member
Credits
25
I have a centos 6.8 vm with one lan interface

eth0 Link encap:Ethernet HWaddr 00:15:5D:94:80:04
inet addr:192.168.1.66 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::215:5dff:fe94:8004/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1371 errors:0 dropped:0 overruns:0 frame:0
TX packets:129 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:291997 (285.1 KiB) TX bytes:12901 (12.5 KiB)

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

DEVICE=eth0
TYPE=Ethernet
UUID=79c8e3e0-6ce8-40db-8de1-03066403f48b
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
NAME="System eth0"
HWADDR=00:15:5D:94:80:04
IPADDR=192.168.1.66
PREFIX=24
GATEWAY=192.168.1.1
DNS1=xx.xx.xx.xx
DNS2=xx.xx.xx.xx
LAST_CONNECT=1621877362

copied the ifcfg-eth0 to ifcfg-eth0:1
edit ifcfg-eth0:1
change DEVICE to eth0:1
change the IPADDR to your second address (in my case 192.168.1.67)
Don't worry about changing anything else
I did not touch anything in UDEV.

I rebooted, network restart may be OK.

I am now able to ssh into either address on the one interface.

[[email protected] ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:15:5D:94:80:04
inet addr:192.168.1.66 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::215:5dff:fe94:8004/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:126 errors:0 dropped:0 overruns:0 frame:0
TX packets:89 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23377 (22.8 KiB) TX bytes:9881 (9.6 KiB)

eth0:1 Link encap:Ethernet HWaddr 00:15:5D:94:80:04
inet addr:192.168.1.67 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Latest posts

Top