LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to persist changes to the routing table?
#1
I am running linux lite 4.6 inside virtualbox. The machine has two network interfaces. I face the issue where the machine isn't able to connect to the internet. After investigation I found the issue to be with my routing table. No idea why this routing table got persisted in the first place.

Code:
$ ip route
default via 192.168.175.1 dev enp0s8 onlink
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
192.168.175.0/24 dev enp0s8 proto kernel scope link src 192.168.175.18

After a bit of tinkering, I have a workaround. I modify the routing table as follows:

Code:
$ ip route
default via 10.0.2.2 dev enp0s3
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
10.0.2.2 via 10.0.2.15 dev enp0s3
192.168.175.0/24 dev enp0s8 proto kernel scope link src 192.168.175.18

I am not sure why the above works.

However, I have to manually issue commands to setup the routing table to the state as shown above, after every reboot.

I have tried some ways to persist using the [tt]/etc/network/interfaces[/tt] file. The below file is an attempt at that:

Code:
auto lo
iface lo inet loopback

auto enp0s3
iface enp0s3 inet dhcp

up /sbin/ip route add 10.0.2.2 via 10.0.2.15
up /sbin/ip route add default via 10.0.2.2

auto enp0s8
iface enp0s8 inet static
    address 192.168.175.18
    netmask 255.255.255.0
    gateway 192.168.175.1

down /sbin/ip route del default

# up /sbin/ip route add 10.0.2.2 via 10.0.2.15
# down /sbin/ip route del default
# up /sbin/ip route add default via 10.0.2.2

But nothing worked.

Next I tried putting the commands in [tt]/etc/rc.local[/tt] that didn't work too.

What is the correct way to persist this?
Reply


Messages In This Thread
How to persist changes to the routing table? - by arun jayapal - 04-04-2020, 03:30 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)