S
S
sudo rm -rf /2020-11-18 18:49:12
linux
sudo rm -rf /, 2020-11-18 18:49:12

How to make linux detect default route automatically?

I have a couple of VirtualBox VMs that are connected by a closed network.
One of the Linux machines also has Internet access using a Briged interface.

ifconfig

eth0: flags=4163 mtu 1500
inet 192.168.1.77 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::a00:27ff:feed:9d4d prefixlen 64 scopeid 0x20
ether 08:00:27:ed:9d:4d txqueuelen 1000 (Ethernet)
RX packets 33 bytes 4318 (4.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 23 bytes 2351 (2.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163 mtu 1500
inet 192.168.99.110 netmask 255.255.255.0 broadcast 192.168.99.255
inet6 fe80::a00:27ff:feaf:7965 prefixlen 64 scopeid 0x20
ether 08:00:27:af:79:65 txqueuelen 1000 (Ethernet)
RX packets 14 bytes 2266 (2.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11 bytes 866 (866.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 85 bytes 28752 (28.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 85 bytes 28752 (28.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0



This interface (eth0) is a wifi adapter, and every time I connect to a different wifi network on my laptop, I have to manually type ip ro add default via $IP dev eth0in .

How to get rid of the direct indication of the gateway address? That he defined it on the interface.
If I write simply ip ro add default dev eth0, then the magic will not work, and the Internet will disappear.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-11-18
@Tabletko

Hang dhcp client on this interface

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question