-2

can anyone tell me on how to make the following commandline changes persistent? (Like via /etc/network/interfaces or /etc/dhcpcd.conf)

route del default
ifconfig eth0 add 172.25.1.1 netmask 255.240.0.0
ifconfig eth0:0 netmask 255.240.0.0
route del default
route add default gw 172.25.0.1

I need to make these changes to make this RPI use a Router as a default gateway a room next to ours. For more info: We don't have direct access to this Router, as in we can't make any changes to it by ourselves.

Am thankful for any insightful responses.

  • 1
    Stack Overflow is a site for programming and development questions. You should probably use another site on the [Stack Exchange network](https://stackexchange.com/sites) for this question. Also see [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. https://superuser.com/questions/tagged/dhcp. – jww Nov 28 '19 at 10:01

1 Answers1

0

To make the route permanent, you need to create a static route configuration file. Create a file with the name route-interface in /etc/sysconfig/network-scripts directory, such as /etc/sysconfig/network-scripts/route-eth0

Then, add the same line you would with ip route add:

172.16.5.0/24 via 10.0.0.101 dev eth0

Make sure to restart your network settings so they take effect:

# service network restart
jww
  • 97,681
  • 90
  • 411
  • 885