You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



How to persist changes to the routing table?

Author (Read 6813 times)

0 Members and 1 Guest are viewing this topic.

Re: How to persist changes to the routing table?
« Reply #4 on: April 17, 2020, 06:29:52 PM »
 

supergamer

  • Forum Regular
  • ***
  • 163
    Posts
  • Reputation: 27
  • Linux Lite Member
    • View Profile

  • CPU: AMD Phenom 565

  • MEMORY: 12Gb

  • VIDEO CARD: 550 ti
Make the script, test the script out after a reboot by using the terminal to execute it then see if it works. Always test first before blindly doing anything that is automatic. If there are errors you should see the errors and if it worked or not.
 

Re: How to persist changes to the routing table?
« Reply #3 on: April 17, 2020, 12:15:09 PM »
 

arun jayapal

  • New to Forums
  • *
  • 2
    Posts
  • Reputation: 0
    • View Profile
Sounds great. However, if there were errors in the script, how can I know what it was...?
 

Re: How to persist changes to the routing table?
« Reply #2 on: April 04, 2020, 08:49:35 PM »
 

supergamer

  • Forum Regular
  • ***
  • 163
    Posts
  • Reputation: 27
  • Linux Lite Member
    • View Profile

  • CPU: AMD Phenom 565

  • MEMORY: 12Gb

  • VIDEO CARD: 550 ti
I am not familiar with crontab but you can setup a cronjob to start at every reboot. How to get exactly what you need is you will have to create a script then just put the script somewhere like in the /usr/scripts folder and use a sudo crontab -e to run the script with @reboot then path to your script. Just an off the wall suggestion.
 

How to persist changes to the routing table?
« Reply #1 on: April 04, 2020, 11:30:18 AM »
 

arun jayapal

  • New to Forums
  • *
  • 2
    Posts
  • Reputation: 0
    • View Profile
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: [Select]
$ 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: [Select]
$ 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 /etc/network/interfaces file. The below file is an attempt at that:

Code: [Select]
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 /etc/rc.local that didn't work too.

What is the correct way to persist this?
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section