Unipi G100 Setup static ip on both interfaces eth0 eth1
-
Hi, I would like to setup both eth interfaces with a static ip. By default the content of
/etc/network/interfaces.d/directory is:root@G100-sn26:/etc/network/interfaces.d# ls br0 eth0 eth1 root@G100-sn26:/etc/network/interfaces.d# cat br0 auto br0 iface br0 inet dhcp bridge_ports eth0 eth1 root@G100-sn26:/etc/network/interfaces.d# cat eth1 allow-hotplug eth1 iface eth1 inet manual root@G100-sn26:/etc/network/interfaces.d# cat eth0 allow-hotplug eth0 iface eth0 inet manualThis means that there will be an interface
br0with DHCP enabled and all traffic from both interfaces is bridged from one to the other (like a switch).What I would like to do is have both interfaces setted up with a static ip (in 2 differents networks). What I tried is to remove the
br0interface and then setupeth0like follow:root@G100-sn26:/etc/network/interfaces.d# rm br0 root@G100-sn26:/etc/network/interfaces.d# cat eth0 allow-hotplug eth0 iface eth0 inet static address 192.168.1.60 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 8.8.4.4If I restart the network service the
eth0interface is working correctly but now If I do the same witheth1:root@G100-sn26:/etc/network/interfaces.d# cat eth1 allow-hotplug eth1 iface eth1 inet static address 192.168.2.60 netmask 255.255.255.0 gateway 192.168.2.1 dns-nameservers 192.168.2.1the device stops responding and I have to put it in service mode to restore the default interfaces configuration. How can I do this?
-
Hi @roberts_lando,
the problem probably lies in the dual gateway settings. The gateway should be set only on one interface. Same applies to the DNS settings, which I would put to the /etc/resolv.conf instead of here.Best regards,
Martin -
I fixed by simply removing
gatewayanddns-nameserversdefinitions from theeth1file.If anyone is interested in this the solution to make this working with also the gateway check: https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System