I want to add static route in ubuntu eth1 interface. Eth1 interface is up and runnng. I could add static route using route add command. It is working. But it was not persistent after reboots. So I decided to add entry in /etc/network/interfaces.But I found only entry for loopback interface n this file. Eth1 was not found. If I simply add the command in that file it is not working. Please help me in this.

share|improve this question
    
@George What you are saying is applicable for iptable commands. But I am not adding iptable command. My command is like this " route add -net 172.16.59.0 netmask 255.255.255.0 gw 172.16.74.135 dev eth1"  – Naveen H Feb 20 '17 at 6:01
    
Let me check that... – George Udosen Feb 20 '17 at 6:16
    
Please add that command /sbin/route route add -net 172.16.59.0 netmask 255.255.255.0 gw 172.16.74.135 dev eth1 to the /etc/rc.local file to persist between reboot... – George Udosen Feb 20 '17 at 6:26
    
Please run sudo lshw | grep eth to get the name of your device... – George Udosen Feb 20 '17 at 6:33
    
This one did not work. – Naveen H Feb 20 '17 at 14:37

There are many solutions. Most of the solutions were not working for me.There was one solution which worked. You can install ifupdown-extra in ubuntu. Then go to /etc/network/network-routes. Here we can add our static route. The syntax is explained in network-routes file itself.Route added like this will persist reboots.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.