Ubuntu 18.04 route to the gateway











up vote
0
down vote

favorite












i just start to use the Ubuntu 18.04. When i try to set up the static IPs on that VM. i can't access the internet. But if i switch to use the gateway as the DHCP device, it works. Any idea what went wrong?



Attached is a screenshot for the ouput of route -n and netplan configuration fileenter image description here



Here is the output if i switch to use the gateway for DHCP:



   root@ubuntu:~# cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens6:
# addresses: [46.16.78.229/24]
dhcp4: yes
# nameservers:
# addresses: [46.16.78.1]
# routes:
# - to: 0.0.0.0/0
# via: 46.16.78.1
# on-link: true
# gateway4: 46.16.78.1
ens7:
dhcp4: no
addresses: [10.14.160.15/24]

root@ubuntu:~# ip route
default via 46.16.78.1 dev ens6 proto dhcp src 46.16.78.29 metric 100
10.14.160.0/24 dev ens7 proto kernel scope link src 10.14.160.15
46.16.78.1 dev ens6 proto dhcp scope link src 46.16.78.29 metric 100
root@ubuntu:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 46.16.78.1 0.0.0.0 UG 100 0 0 ens6
10.14.160.0 0.0.0.0 255.255.255.0 U 0 0 0 ens7
46.16.78.1 0.0.0.0 255.255.255.255 UH 100 0 0 ens6









share|improve this question
























  • Do not post text as images. Copy the relevant text, and apply code formatting on SE.
    – vidarlo
    Dec 4 at 11:34















up vote
0
down vote

favorite












i just start to use the Ubuntu 18.04. When i try to set up the static IPs on that VM. i can't access the internet. But if i switch to use the gateway as the DHCP device, it works. Any idea what went wrong?



Attached is a screenshot for the ouput of route -n and netplan configuration fileenter image description here



Here is the output if i switch to use the gateway for DHCP:



   root@ubuntu:~# cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens6:
# addresses: [46.16.78.229/24]
dhcp4: yes
# nameservers:
# addresses: [46.16.78.1]
# routes:
# - to: 0.0.0.0/0
# via: 46.16.78.1
# on-link: true
# gateway4: 46.16.78.1
ens7:
dhcp4: no
addresses: [10.14.160.15/24]

root@ubuntu:~# ip route
default via 46.16.78.1 dev ens6 proto dhcp src 46.16.78.29 metric 100
10.14.160.0/24 dev ens7 proto kernel scope link src 10.14.160.15
46.16.78.1 dev ens6 proto dhcp scope link src 46.16.78.29 metric 100
root@ubuntu:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 46.16.78.1 0.0.0.0 UG 100 0 0 ens6
10.14.160.0 0.0.0.0 255.255.255.0 U 0 0 0 ens7
46.16.78.1 0.0.0.0 255.255.255.255 UH 100 0 0 ens6









share|improve this question
























  • Do not post text as images. Copy the relevant text, and apply code formatting on SE.
    – vidarlo
    Dec 4 at 11:34













up vote
0
down vote

favorite









up vote
0
down vote

favorite











i just start to use the Ubuntu 18.04. When i try to set up the static IPs on that VM. i can't access the internet. But if i switch to use the gateway as the DHCP device, it works. Any idea what went wrong?



Attached is a screenshot for the ouput of route -n and netplan configuration fileenter image description here



Here is the output if i switch to use the gateway for DHCP:



   root@ubuntu:~# cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens6:
# addresses: [46.16.78.229/24]
dhcp4: yes
# nameservers:
# addresses: [46.16.78.1]
# routes:
# - to: 0.0.0.0/0
# via: 46.16.78.1
# on-link: true
# gateway4: 46.16.78.1
ens7:
dhcp4: no
addresses: [10.14.160.15/24]

root@ubuntu:~# ip route
default via 46.16.78.1 dev ens6 proto dhcp src 46.16.78.29 metric 100
10.14.160.0/24 dev ens7 proto kernel scope link src 10.14.160.15
46.16.78.1 dev ens6 proto dhcp scope link src 46.16.78.29 metric 100
root@ubuntu:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 46.16.78.1 0.0.0.0 UG 100 0 0 ens6
10.14.160.0 0.0.0.0 255.255.255.0 U 0 0 0 ens7
46.16.78.1 0.0.0.0 255.255.255.255 UH 100 0 0 ens6









share|improve this question















i just start to use the Ubuntu 18.04. When i try to set up the static IPs on that VM. i can't access the internet. But if i switch to use the gateway as the DHCP device, it works. Any idea what went wrong?



Attached is a screenshot for the ouput of route -n and netplan configuration fileenter image description here



Here is the output if i switch to use the gateway for DHCP:



   root@ubuntu:~# cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens6:
# addresses: [46.16.78.229/24]
dhcp4: yes
# nameservers:
# addresses: [46.16.78.1]
# routes:
# - to: 0.0.0.0/0
# via: 46.16.78.1
# on-link: true
# gateway4: 46.16.78.1
ens7:
dhcp4: no
addresses: [10.14.160.15/24]

root@ubuntu:~# ip route
default via 46.16.78.1 dev ens6 proto dhcp src 46.16.78.29 metric 100
10.14.160.0/24 dev ens7 proto kernel scope link src 10.14.160.15
46.16.78.1 dev ens6 proto dhcp scope link src 46.16.78.29 metric 100
root@ubuntu:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 46.16.78.1 0.0.0.0 UG 100 0 0 ens6
10.14.160.0 0.0.0.0 255.255.255.0 U 0 0 0 ens7
46.16.78.1 0.0.0.0 255.255.255.255 UH 100 0 0 ens6






18.04 netplan






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 4 at 11:51

























asked Dec 4 at 11:24









Chao Yuan

11




11












  • Do not post text as images. Copy the relevant text, and apply code formatting on SE.
    – vidarlo
    Dec 4 at 11:34


















  • Do not post text as images. Copy the relevant text, and apply code formatting on SE.
    – vidarlo
    Dec 4 at 11:34
















Do not post text as images. Copy the relevant text, and apply code formatting on SE.
– vidarlo
Dec 4 at 11:34




Do not post text as images. Copy the relevant text, and apply code formatting on SE.
– vidarlo
Dec 4 at 11:34










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Change the



adresses: [46.16.78.229/32]


to



adresses: [46.16.78.229/24]


/32 indicates that it is a subnet with only 46.16.78.229 in the network, with no access to any other IP addresses. Thus your computer has no idea of how to reach your configured GW.






share|improve this answer





















  • i tried to change to /24, but it still does't work..
    – Chao Yuan
    Dec 4 at 11:44










  • Update your question with the output of ip route with the correct configuration.
    – vidarlo
    Dec 4 at 11:46










  • just updated the output
    – Chao Yuan
    Dec 4 at 12:36






  • 1




    The 'ip route' information shown corresponds to a dhcp-provided route, not to a statically configured route. This is clearly inconsistent. Listing /32 in the addresses is clearly wrong, switching this to /24 reliably fixes this problem.
    – slangasek
    Dec 5 at 8:43












  • Indeed. Please provide output of ip route when you have the corrected configuration in place, not DHCP.
    – vidarlo
    Dec 5 at 8:46











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1098358%2fubuntu-18-04-route-to-the-gateway%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Change the



adresses: [46.16.78.229/32]


to



adresses: [46.16.78.229/24]


/32 indicates that it is a subnet with only 46.16.78.229 in the network, with no access to any other IP addresses. Thus your computer has no idea of how to reach your configured GW.






share|improve this answer





















  • i tried to change to /24, but it still does't work..
    – Chao Yuan
    Dec 4 at 11:44










  • Update your question with the output of ip route with the correct configuration.
    – vidarlo
    Dec 4 at 11:46










  • just updated the output
    – Chao Yuan
    Dec 4 at 12:36






  • 1




    The 'ip route' information shown corresponds to a dhcp-provided route, not to a statically configured route. This is clearly inconsistent. Listing /32 in the addresses is clearly wrong, switching this to /24 reliably fixes this problem.
    – slangasek
    Dec 5 at 8:43












  • Indeed. Please provide output of ip route when you have the corrected configuration in place, not DHCP.
    – vidarlo
    Dec 5 at 8:46















up vote
0
down vote













Change the



adresses: [46.16.78.229/32]


to



adresses: [46.16.78.229/24]


/32 indicates that it is a subnet with only 46.16.78.229 in the network, with no access to any other IP addresses. Thus your computer has no idea of how to reach your configured GW.






share|improve this answer





















  • i tried to change to /24, but it still does't work..
    – Chao Yuan
    Dec 4 at 11:44










  • Update your question with the output of ip route with the correct configuration.
    – vidarlo
    Dec 4 at 11:46










  • just updated the output
    – Chao Yuan
    Dec 4 at 12:36






  • 1




    The 'ip route' information shown corresponds to a dhcp-provided route, not to a statically configured route. This is clearly inconsistent. Listing /32 in the addresses is clearly wrong, switching this to /24 reliably fixes this problem.
    – slangasek
    Dec 5 at 8:43












  • Indeed. Please provide output of ip route when you have the corrected configuration in place, not DHCP.
    – vidarlo
    Dec 5 at 8:46













up vote
0
down vote










up vote
0
down vote









Change the



adresses: [46.16.78.229/32]


to



adresses: [46.16.78.229/24]


/32 indicates that it is a subnet with only 46.16.78.229 in the network, with no access to any other IP addresses. Thus your computer has no idea of how to reach your configured GW.






share|improve this answer












Change the



adresses: [46.16.78.229/32]


to



adresses: [46.16.78.229/24]


/32 indicates that it is a subnet with only 46.16.78.229 in the network, with no access to any other IP addresses. Thus your computer has no idea of how to reach your configured GW.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 4 at 11:33









vidarlo

8,76842342




8,76842342












  • i tried to change to /24, but it still does't work..
    – Chao Yuan
    Dec 4 at 11:44










  • Update your question with the output of ip route with the correct configuration.
    – vidarlo
    Dec 4 at 11:46










  • just updated the output
    – Chao Yuan
    Dec 4 at 12:36






  • 1




    The 'ip route' information shown corresponds to a dhcp-provided route, not to a statically configured route. This is clearly inconsistent. Listing /32 in the addresses is clearly wrong, switching this to /24 reliably fixes this problem.
    – slangasek
    Dec 5 at 8:43












  • Indeed. Please provide output of ip route when you have the corrected configuration in place, not DHCP.
    – vidarlo
    Dec 5 at 8:46


















  • i tried to change to /24, but it still does't work..
    – Chao Yuan
    Dec 4 at 11:44










  • Update your question with the output of ip route with the correct configuration.
    – vidarlo
    Dec 4 at 11:46










  • just updated the output
    – Chao Yuan
    Dec 4 at 12:36






  • 1




    The 'ip route' information shown corresponds to a dhcp-provided route, not to a statically configured route. This is clearly inconsistent. Listing /32 in the addresses is clearly wrong, switching this to /24 reliably fixes this problem.
    – slangasek
    Dec 5 at 8:43












  • Indeed. Please provide output of ip route when you have the corrected configuration in place, not DHCP.
    – vidarlo
    Dec 5 at 8:46
















i tried to change to /24, but it still does't work..
– Chao Yuan
Dec 4 at 11:44




i tried to change to /24, but it still does't work..
– Chao Yuan
Dec 4 at 11:44












Update your question with the output of ip route with the correct configuration.
– vidarlo
Dec 4 at 11:46




Update your question with the output of ip route with the correct configuration.
– vidarlo
Dec 4 at 11:46












just updated the output
– Chao Yuan
Dec 4 at 12:36




just updated the output
– Chao Yuan
Dec 4 at 12:36




1




1




The 'ip route' information shown corresponds to a dhcp-provided route, not to a statically configured route. This is clearly inconsistent. Listing /32 in the addresses is clearly wrong, switching this to /24 reliably fixes this problem.
– slangasek
Dec 5 at 8:43






The 'ip route' information shown corresponds to a dhcp-provided route, not to a statically configured route. This is clearly inconsistent. Listing /32 in the addresses is clearly wrong, switching this to /24 reliably fixes this problem.
– slangasek
Dec 5 at 8:43














Indeed. Please provide output of ip route when you have the corrected configuration in place, not DHCP.
– vidarlo
Dec 5 at 8:46




Indeed. Please provide output of ip route when you have the corrected configuration in place, not DHCP.
– vidarlo
Dec 5 at 8:46


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1098358%2fubuntu-18-04-route-to-the-gateway%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕