Ubuntu Server cannot add permanent static route
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
I'm running Ubuntu Server 16.04.4
After a lot of struggling I managed to configure both ethernet and wireless connections.
The content of /etc/network/interfaces file is this:
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# Ethernet network interface
allow-hotplug enp9s0
iface enp9s0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
# Wireless network interface
allow-hotplug wlp5s0b1
iface wlp5s0b1 inet static
address 192.168.1.151
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
up route add default gw 192.168.1.1 dev wlp5s0b1
and in /etc/wpa_supplicant/wpa_supplicant.conf there is the output of:
wpa_passphrase "MY SSID" MY_PASSWORD | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf
which is:
network=
ssid="MY SSID"
#psk="MY_PASSWORD_IN_CLEAR"
psk=LONG_HEX_STRING
Now, ifconfig shows that:
enp9s0 Link encap:Ethernet IndirizzoHW 00:24:54:ad:ac:b4
indirizzo inet:192.168.1.150 Bcast:192.168.1.255 Maschera:255.255.255.0
indirizzo inet6: fe80::224:54ff:fead:acb4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:435 errors:0 dropped:0 overruns:0 frame:0
TX packets:195 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1000
Byte RX:54426 (54.4 KB) Byte TX:26620 (26.6 KB)
Interrupt:18
lo Link encap:Loopback locale
indirizzo inet:127.0.0.1 Maschera:255.0.0.0
indirizzo inet6: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:14256 errors:0 dropped:0 overruns:0 frame:0
TX packets:14256 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1
Byte RX:1055216 (1.0 MB) Byte TX:1055216 (1.0 MB)
wlp5s0b1 Link encap:Ethernet IndirizzoHW 00:1b:b1:48:12:86
indirizzo inet:192.168.1.151 Bcast:192.168.1.255 Maschera:255.255.255.0
indirizzo inet6: fe80::21b:b1ff:fe48:1286/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:695 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1000
Byte RX:125974 (125.9 KB) Byte TX:3316 (3.3 KB)
and the routing table is this:
tommy@ubuntu-server:~$ route -n
Tabella di routing IP del kernel
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp5s0b1
If I ping with the ethernet cable connected, all works good.
But if I remove the ethernet cable and ping 8.8.8.8 it's not working.
Now my guess is that in the routing table is missing a line like this:
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp5s0b1
In fact, if I run:
sudo route add default gw 192.168.1.1 wlp5s0b1
then the routing table is:
tommy@ubuntu-server:~$ route -n
Tabella di routing IP del kernel
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp5s0b1
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp5s0b1
and ping 8.8.8.8 without the ethernet cable work just fine.
So my question is this: is there a way of keep permanent the route that I added?
I've already tried to write the command in the last line of the /etc/network/interfaces file, as you can see above, in many different ways:
- up route add default gw 192.168.1.1
- up route add default gw 192.168.1.1 wlp5s0b1
- up route add default gw 192.168.1.1 dev wlp5s0b1
- as above but with up ip route ...
- as above but with post-up instead of up
but it's not working.
Am I missing the correct syntax or is there any other solution?
Thanks for your help!
networking server wireless ethernet
add a comment |Â
up vote
0
down vote
favorite
I'm running Ubuntu Server 16.04.4
After a lot of struggling I managed to configure both ethernet and wireless connections.
The content of /etc/network/interfaces file is this:
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# Ethernet network interface
allow-hotplug enp9s0
iface enp9s0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
# Wireless network interface
allow-hotplug wlp5s0b1
iface wlp5s0b1 inet static
address 192.168.1.151
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
up route add default gw 192.168.1.1 dev wlp5s0b1
and in /etc/wpa_supplicant/wpa_supplicant.conf there is the output of:
wpa_passphrase "MY SSID" MY_PASSWORD | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf
which is:
network=
ssid="MY SSID"
#psk="MY_PASSWORD_IN_CLEAR"
psk=LONG_HEX_STRING
Now, ifconfig shows that:
enp9s0 Link encap:Ethernet IndirizzoHW 00:24:54:ad:ac:b4
indirizzo inet:192.168.1.150 Bcast:192.168.1.255 Maschera:255.255.255.0
indirizzo inet6: fe80::224:54ff:fead:acb4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:435 errors:0 dropped:0 overruns:0 frame:0
TX packets:195 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1000
Byte RX:54426 (54.4 KB) Byte TX:26620 (26.6 KB)
Interrupt:18
lo Link encap:Loopback locale
indirizzo inet:127.0.0.1 Maschera:255.0.0.0
indirizzo inet6: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:14256 errors:0 dropped:0 overruns:0 frame:0
TX packets:14256 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1
Byte RX:1055216 (1.0 MB) Byte TX:1055216 (1.0 MB)
wlp5s0b1 Link encap:Ethernet IndirizzoHW 00:1b:b1:48:12:86
indirizzo inet:192.168.1.151 Bcast:192.168.1.255 Maschera:255.255.255.0
indirizzo inet6: fe80::21b:b1ff:fe48:1286/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:695 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1000
Byte RX:125974 (125.9 KB) Byte TX:3316 (3.3 KB)
and the routing table is this:
tommy@ubuntu-server:~$ route -n
Tabella di routing IP del kernel
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp5s0b1
If I ping with the ethernet cable connected, all works good.
But if I remove the ethernet cable and ping 8.8.8.8 it's not working.
Now my guess is that in the routing table is missing a line like this:
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp5s0b1
In fact, if I run:
sudo route add default gw 192.168.1.1 wlp5s0b1
then the routing table is:
tommy@ubuntu-server:~$ route -n
Tabella di routing IP del kernel
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp5s0b1
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp5s0b1
and ping 8.8.8.8 without the ethernet cable work just fine.
So my question is this: is there a way of keep permanent the route that I added?
I've already tried to write the command in the last line of the /etc/network/interfaces file, as you can see above, in many different ways:
- up route add default gw 192.168.1.1
- up route add default gw 192.168.1.1 wlp5s0b1
- up route add default gw 192.168.1.1 dev wlp5s0b1
- as above but with up ip route ...
- as above but with post-up instead of up
but it's not working.
Am I missing the correct syntax or is there any other solution?
Thanks for your help!
networking server wireless ethernet
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm running Ubuntu Server 16.04.4
After a lot of struggling I managed to configure both ethernet and wireless connections.
The content of /etc/network/interfaces file is this:
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# Ethernet network interface
allow-hotplug enp9s0
iface enp9s0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
# Wireless network interface
allow-hotplug wlp5s0b1
iface wlp5s0b1 inet static
address 192.168.1.151
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
up route add default gw 192.168.1.1 dev wlp5s0b1
and in /etc/wpa_supplicant/wpa_supplicant.conf there is the output of:
wpa_passphrase "MY SSID" MY_PASSWORD | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf
which is:
network=
ssid="MY SSID"
#psk="MY_PASSWORD_IN_CLEAR"
psk=LONG_HEX_STRING
Now, ifconfig shows that:
enp9s0 Link encap:Ethernet IndirizzoHW 00:24:54:ad:ac:b4
indirizzo inet:192.168.1.150 Bcast:192.168.1.255 Maschera:255.255.255.0
indirizzo inet6: fe80::224:54ff:fead:acb4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:435 errors:0 dropped:0 overruns:0 frame:0
TX packets:195 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1000
Byte RX:54426 (54.4 KB) Byte TX:26620 (26.6 KB)
Interrupt:18
lo Link encap:Loopback locale
indirizzo inet:127.0.0.1 Maschera:255.0.0.0
indirizzo inet6: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:14256 errors:0 dropped:0 overruns:0 frame:0
TX packets:14256 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1
Byte RX:1055216 (1.0 MB) Byte TX:1055216 (1.0 MB)
wlp5s0b1 Link encap:Ethernet IndirizzoHW 00:1b:b1:48:12:86
indirizzo inet:192.168.1.151 Bcast:192.168.1.255 Maschera:255.255.255.0
indirizzo inet6: fe80::21b:b1ff:fe48:1286/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:695 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1000
Byte RX:125974 (125.9 KB) Byte TX:3316 (3.3 KB)
and the routing table is this:
tommy@ubuntu-server:~$ route -n
Tabella di routing IP del kernel
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp5s0b1
If I ping with the ethernet cable connected, all works good.
But if I remove the ethernet cable and ping 8.8.8.8 it's not working.
Now my guess is that in the routing table is missing a line like this:
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp5s0b1
In fact, if I run:
sudo route add default gw 192.168.1.1 wlp5s0b1
then the routing table is:
tommy@ubuntu-server:~$ route -n
Tabella di routing IP del kernel
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp5s0b1
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp5s0b1
and ping 8.8.8.8 without the ethernet cable work just fine.
So my question is this: is there a way of keep permanent the route that I added?
I've already tried to write the command in the last line of the /etc/network/interfaces file, as you can see above, in many different ways:
- up route add default gw 192.168.1.1
- up route add default gw 192.168.1.1 wlp5s0b1
- up route add default gw 192.168.1.1 dev wlp5s0b1
- as above but with up ip route ...
- as above but with post-up instead of up
but it's not working.
Am I missing the correct syntax or is there any other solution?
Thanks for your help!
networking server wireless ethernet
I'm running Ubuntu Server 16.04.4
After a lot of struggling I managed to configure both ethernet and wireless connections.
The content of /etc/network/interfaces file is this:
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# Ethernet network interface
allow-hotplug enp9s0
iface enp9s0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
# Wireless network interface
allow-hotplug wlp5s0b1
iface wlp5s0b1 inet static
address 192.168.1.151
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
up route add default gw 192.168.1.1 dev wlp5s0b1
and in /etc/wpa_supplicant/wpa_supplicant.conf there is the output of:
wpa_passphrase "MY SSID" MY_PASSWORD | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf
which is:
network=
ssid="MY SSID"
#psk="MY_PASSWORD_IN_CLEAR"
psk=LONG_HEX_STRING
Now, ifconfig shows that:
enp9s0 Link encap:Ethernet IndirizzoHW 00:24:54:ad:ac:b4
indirizzo inet:192.168.1.150 Bcast:192.168.1.255 Maschera:255.255.255.0
indirizzo inet6: fe80::224:54ff:fead:acb4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:435 errors:0 dropped:0 overruns:0 frame:0
TX packets:195 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1000
Byte RX:54426 (54.4 KB) Byte TX:26620 (26.6 KB)
Interrupt:18
lo Link encap:Loopback locale
indirizzo inet:127.0.0.1 Maschera:255.0.0.0
indirizzo inet6: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:14256 errors:0 dropped:0 overruns:0 frame:0
TX packets:14256 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1
Byte RX:1055216 (1.0 MB) Byte TX:1055216 (1.0 MB)
wlp5s0b1 Link encap:Ethernet IndirizzoHW 00:1b:b1:48:12:86
indirizzo inet:192.168.1.151 Bcast:192.168.1.255 Maschera:255.255.255.0
indirizzo inet6: fe80::21b:b1ff:fe48:1286/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:695 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1000
Byte RX:125974 (125.9 KB) Byte TX:3316 (3.3 KB)
and the routing table is this:
tommy@ubuntu-server:~$ route -n
Tabella di routing IP del kernel
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp5s0b1
If I ping with the ethernet cable connected, all works good.
But if I remove the ethernet cable and ping 8.8.8.8 it's not working.
Now my guess is that in the routing table is missing a line like this:
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp5s0b1
In fact, if I run:
sudo route add default gw 192.168.1.1 wlp5s0b1
then the routing table is:
tommy@ubuntu-server:~$ route -n
Tabella di routing IP del kernel
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp5s0b1
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp9s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp5s0b1
and ping 8.8.8.8 without the ethernet cable work just fine.
So my question is this: is there a way of keep permanent the route that I added?
I've already tried to write the command in the last line of the /etc/network/interfaces file, as you can see above, in many different ways:
- up route add default gw 192.168.1.1
- up route add default gw 192.168.1.1 wlp5s0b1
- up route add default gw 192.168.1.1 dev wlp5s0b1
- as above but with up ip route ...
- as above but with post-up instead of up
but it's not working.
Am I missing the correct syntax or is there any other solution?
Thanks for your help!
networking server wireless ethernet
asked Apr 26 at 15:49
![](https://i.stack.imgur.com/y85rU.png?s=32&g=1)
![](https://i.stack.imgur.com/y85rU.png?s=32&g=1)
Tommy
62
62
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028462%2fubuntu-server-cannot-add-permanent-static-route%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password