0

I am a novice when it comes to all things networking. I have a MOXA-UC-8112 gateway that I am trying to connect to the network. The gateway embeds a debian 9. The eth0 interface for the LAN works fine. I am now trying to connect the eth1 interface to the WAN.

Here is my configuration file /etc/network/interfaces:

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto eth0 eth1 lo
iface lo inet loopback
iface eth0 inet static
    address 172.AAA.AAA.AAA
    network 172.BBB.BBB.BBB
    netmask 255.CCC.CCC.CCC
    gateway 172.DDD.DDD.DDD
iface eth1 inet static
    address 176.AAA.AAA.AAA
    network 176.BBB.BBB.BBB
    netmask 255.EEE.EEE.EEE
    gateway 176.DDD.DDD.DDD

Here is the output of ip route:

    default via 172.DDD.DDD.DDDdev eth0 onlink
172.BBB.BBB.BBB/CC dev eth0 proto kernel scope link src 172.AAA.AAA.AAA
176.BBB.BBB.BBB/EE dev eth1 proto kernel scope link src 176.AAA.AAA.AAA

After configuring these two interfaces, I try to restart the networking service. And this is when the RTNETLINK error messages arrives.

    Mar 21 09:02:27 XXXX ifup[1981]: RTNETLINK answers: File exists
    Mar 21 09:02:27 XXXX ifup[1981]: ifup: failed to bring up eth1
    Mar 21 09:02:27 XXXX systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
    Mar 21 09:02:27 XXXX systemd[1]: Failed to start Raise network interfaces.

This error occurs when using ifup :

ifup -v eth1
ifup: reading directory /etc/network/interfaces.d

ifup: configuring interface eth1=eth1 (inet)
/bin/run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/ethtool
run-parts: executing /etc/network/if-pre-up.d/ifenslave
+ [ inet = meta ]
+ IF_BOND_SLAVES=
+ [  ]
+ [  ]
+ [ -z  ]
+ exit
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
/bin/ip addr add 176.AAA.AAA.AAA/255.EEE.EEE.EEE broadcast 176.XXX.XXX.XXX       dev eth1 label eth1
RTNETLINK answers: File exists
ifup: failed to bring up eth1

Another error occurs when using ifdown :

ifdown -v eth1
ifdown: reading directory /etc/network/interfaces.d
ifdown: interface eth1 not configured

I've tried it all: sudo ip addr flush dev eth1, sudo ifdown eth1 && sudo ifup eth1, nano /run/network/ifstate reboot ...

1

1 Answer 1

1

The problem is dual gateways in /etc/interfaces.

ip route shows

default via 172.DDD.DDD.DDDdev eth0 onlink

which means the system will try to access the internet through this interface. Not the way it should be as eth1 is your WAN link. Default route should point to the next-hop router behind eth1.

As eth0 is in your internal network, it should be in the same network with the rest of the devices so gateway isn't needed. All devices in the same subnet can communicate directly with each other. Gateway router is needed only to forward traffic into and out of a subnet.

Comment out or delete the the gateway in eth0 config and you should be good.

If you still get same message, give commands ip addr flush dev eth0 and ip addr flush dev eth1, and retry ifup.

2
  • Thanks a lot, it's now working a lot better.
    – jochlt
    Mar 24, 2023 at 7:39
  • Glad to hear that :-) Please note, SE sites are Q&A sites, not discussion forums. If an answer helps you resolve your issue, the way to show it is to accept the answer. As a new member of the community it's a good idea to check the Tour, the Asking and Answering -sections in the Help Center and some old questions with accepted answers to learn how this works :-) Mar 24, 2023 at 7:43

You must log in to answer this question.

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