netplan configuration on Ubuntu 17.04 virtual machine

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
5
down vote

favorite
1












I'm running VirtualBox with 2 network adapters: standard NAT (enp0s3) and a Host-only Adapter (enp0s8). I use the NAT to access the internet and the Host-only Adapter to SSH in from my local machine.



The box boots up with both adapters enabled, both have IP addresses, everything looking good.



ifconfig-output



I can SSH into this box over the host-only adapter, no issues there. But I can't get on the internet with it. However, if I disable the host-only adapter, then I can access the internet (but obviously I can no longer SSH into it over the local tunnel).



console-output



And finally, here is my netplan yaml config:



# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
dhcp6: yes
enp0s8:
dhcp4: no
dhcp6: no
addresses: [192.168.52.101/24]
gateway4: 192.168.52.101


Any ideas? It seems like maybe all my outbound traffic is routing through the host-only adapter somehow.



Edit: attaching the output of ip route list in case it helps.



default via 192.168.52.101 dev enp0s8 proto static
default via 10.0.2.2 dev enp0s3 proto dhcp src 10.0.2.15 metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
10.0.2.2 dev enp0s3 proto dhcp scope link src 10.0.2.15 metric 100
192.168.52.0/24 dev enp0s8 proto kernel scope link src 192.168.52.101






share|improve this question





















  • Forget it, I couldn't figure out netplan so I formatted and installed Ubuntu 16 instead.
    – hellojason
    Dec 11 '17 at 2:17














up vote
5
down vote

favorite
1












I'm running VirtualBox with 2 network adapters: standard NAT (enp0s3) and a Host-only Adapter (enp0s8). I use the NAT to access the internet and the Host-only Adapter to SSH in from my local machine.



The box boots up with both adapters enabled, both have IP addresses, everything looking good.



ifconfig-output



I can SSH into this box over the host-only adapter, no issues there. But I can't get on the internet with it. However, if I disable the host-only adapter, then I can access the internet (but obviously I can no longer SSH into it over the local tunnel).



console-output



And finally, here is my netplan yaml config:



# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
dhcp6: yes
enp0s8:
dhcp4: no
dhcp6: no
addresses: [192.168.52.101/24]
gateway4: 192.168.52.101


Any ideas? It seems like maybe all my outbound traffic is routing through the host-only adapter somehow.



Edit: attaching the output of ip route list in case it helps.



default via 192.168.52.101 dev enp0s8 proto static
default via 10.0.2.2 dev enp0s3 proto dhcp src 10.0.2.15 metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
10.0.2.2 dev enp0s3 proto dhcp scope link src 10.0.2.15 metric 100
192.168.52.0/24 dev enp0s8 proto kernel scope link src 192.168.52.101






share|improve this question





















  • Forget it, I couldn't figure out netplan so I formatted and installed Ubuntu 16 instead.
    – hellojason
    Dec 11 '17 at 2:17












up vote
5
down vote

favorite
1









up vote
5
down vote

favorite
1






1





I'm running VirtualBox with 2 network adapters: standard NAT (enp0s3) and a Host-only Adapter (enp0s8). I use the NAT to access the internet and the Host-only Adapter to SSH in from my local machine.



The box boots up with both adapters enabled, both have IP addresses, everything looking good.



ifconfig-output



I can SSH into this box over the host-only adapter, no issues there. But I can't get on the internet with it. However, if I disable the host-only adapter, then I can access the internet (but obviously I can no longer SSH into it over the local tunnel).



console-output



And finally, here is my netplan yaml config:



# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
dhcp6: yes
enp0s8:
dhcp4: no
dhcp6: no
addresses: [192.168.52.101/24]
gateway4: 192.168.52.101


Any ideas? It seems like maybe all my outbound traffic is routing through the host-only adapter somehow.



Edit: attaching the output of ip route list in case it helps.



default via 192.168.52.101 dev enp0s8 proto static
default via 10.0.2.2 dev enp0s3 proto dhcp src 10.0.2.15 metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
10.0.2.2 dev enp0s3 proto dhcp scope link src 10.0.2.15 metric 100
192.168.52.0/24 dev enp0s8 proto kernel scope link src 192.168.52.101






share|improve this question













I'm running VirtualBox with 2 network adapters: standard NAT (enp0s3) and a Host-only Adapter (enp0s8). I use the NAT to access the internet and the Host-only Adapter to SSH in from my local machine.



The box boots up with both adapters enabled, both have IP addresses, everything looking good.



ifconfig-output



I can SSH into this box over the host-only adapter, no issues there. But I can't get on the internet with it. However, if I disable the host-only adapter, then I can access the internet (but obviously I can no longer SSH into it over the local tunnel).



console-output



And finally, here is my netplan yaml config:



# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
dhcp6: yes
enp0s8:
dhcp4: no
dhcp6: no
addresses: [192.168.52.101/24]
gateway4: 192.168.52.101


Any ideas? It seems like maybe all my outbound traffic is routing through the host-only adapter somehow.



Edit: attaching the output of ip route list in case it helps.



default via 192.168.52.101 dev enp0s8 proto static
default via 10.0.2.2 dev enp0s3 proto dhcp src 10.0.2.15 metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
10.0.2.2 dev enp0s3 proto dhcp scope link src 10.0.2.15 metric 100
192.168.52.0/24 dev enp0s8 proto kernel scope link src 192.168.52.101








share|improve this question












share|improve this question




share|improve this question








edited Apr 11 at 3:27









dpb

4,88911545




4,88911545









asked Dec 8 '17 at 17:31









hellojason

263




263











  • Forget it, I couldn't figure out netplan so I formatted and installed Ubuntu 16 instead.
    – hellojason
    Dec 11 '17 at 2:17
















  • Forget it, I couldn't figure out netplan so I formatted and installed Ubuntu 16 instead.
    – hellojason
    Dec 11 '17 at 2:17















Forget it, I couldn't figure out netplan so I formatted and installed Ubuntu 16 instead.
– hellojason
Dec 11 '17 at 2:17




Forget it, I couldn't figure out netplan so I formatted and installed Ubuntu 16 instead.
– hellojason
Dec 11 '17 at 2:17










3 Answers
3






active

oldest

votes

















up vote
5
down vote













I found this problem doing exactly the same thing this afternoon. Somehow managed to figure it out and netplan finally created only 1 default route through the NAT interface of my VM. In my case, both IP's were 192.168.56.101 (host-only) and 10.0.3.x/24 (NAT dhcp4). I'm using this netplan file:



 network:
version: 2
renderer: networkd
ethernets:
enp0s8:
dhcp4: yes
dhcp6: yes
routes:
- to: 0.0.0.0/0
via: 10.0.3.2
metric: 0
enp0s3:
dhcp4: no
dhcp6: no
addresses: [192.168.56.101/24]
routes:
- to: 192.168.56.1/24
via: 192.168.56.1
metric: 100


With this I have only one default route, and it's using the NAT so it can reach the internet through my host.



Output of ip r



default via 10.0.3.2 dev enp0s8 proto dhcp src 10.0.3.15 metric 100
10.0.3.0/24 dev enp0s8 proto kernel scope link src 10.0.3.15
10.0.3.2 dev enp0s8 proto dhcp scope link src 10.0.3.15 metric 100
192.168.56.0/24 dev enp0s3 proto kernel scope link src 192.168.56.10





share|improve this answer

















  • 2




    Great answer! You indeed need to set up your own routing in this case. If both devices include a "default gateway" (ie. they specify "dhcp4" or "dhcp6", or set "gateway4"), then the system will set up both devices with a default gateway with the same metric. You won't need the route on enp0s3 however, since the "addresses" already contain the same /24 subnet as the one that would be used to access 192.168.56.1. Alternatively, set your own routing everywhere as you are doing.
    – Mathieu Trudel-Lapierre
    Mar 9 at 11:23


















up vote
2
down vote













For me removing gateway4 from configuration did the trick. With it configured I was also not able to ping internet.



Here is my netPlan config if it can help others.



Note: enp0s3 is for ssh via port forwarding and enp0s8 for static ip



network:
ethernets:
enp0s3:
addresses:
dhcp4: true
optional: true
enp0s8:
addresses: [192.168.10.20/24]
dhcp4: no
dhcp6: no
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
version: 2





share|improve this answer




























    up vote
    0
    down vote













    As a note, while I was struggling with this and VMware Fusion... If you have any 'gateway4' value specified, it will assume that as default for the interface, and it doesn't seem to respect the 'metric' option or having multiple .yaml files with a numbering sequence (01-netplan.yaml, 02-netplan.yaml, etc...) in my case 02 ended up being the 'first default', but that is my internal network so public internet was unreachable.






    share|improve this answer





















    • Hi Mike -- welcome to askubuntu. This would be better as a Comment under the question. You should move the text there and just delete this as it isn't intended to "answer" the question.
      – dpb
      Apr 11 at 3:35










    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: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    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%2f984445%2fnetplan-configuration-on-ubuntu-17-04-virtual-machine%23new-answer', 'question_page');

    );

    Post as a guest






























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    5
    down vote













    I found this problem doing exactly the same thing this afternoon. Somehow managed to figure it out and netplan finally created only 1 default route through the NAT interface of my VM. In my case, both IP's were 192.168.56.101 (host-only) and 10.0.3.x/24 (NAT dhcp4). I'm using this netplan file:



     network:
    version: 2
    renderer: networkd
    ethernets:
    enp0s8:
    dhcp4: yes
    dhcp6: yes
    routes:
    - to: 0.0.0.0/0
    via: 10.0.3.2
    metric: 0
    enp0s3:
    dhcp4: no
    dhcp6: no
    addresses: [192.168.56.101/24]
    routes:
    - to: 192.168.56.1/24
    via: 192.168.56.1
    metric: 100


    With this I have only one default route, and it's using the NAT so it can reach the internet through my host.



    Output of ip r



    default via 10.0.3.2 dev enp0s8 proto dhcp src 10.0.3.15 metric 100
    10.0.3.0/24 dev enp0s8 proto kernel scope link src 10.0.3.15
    10.0.3.2 dev enp0s8 proto dhcp scope link src 10.0.3.15 metric 100
    192.168.56.0/24 dev enp0s3 proto kernel scope link src 192.168.56.10





    share|improve this answer

















    • 2




      Great answer! You indeed need to set up your own routing in this case. If both devices include a "default gateway" (ie. they specify "dhcp4" or "dhcp6", or set "gateway4"), then the system will set up both devices with a default gateway with the same metric. You won't need the route on enp0s3 however, since the "addresses" already contain the same /24 subnet as the one that would be used to access 192.168.56.1. Alternatively, set your own routing everywhere as you are doing.
      – Mathieu Trudel-Lapierre
      Mar 9 at 11:23















    up vote
    5
    down vote













    I found this problem doing exactly the same thing this afternoon. Somehow managed to figure it out and netplan finally created only 1 default route through the NAT interface of my VM. In my case, both IP's were 192.168.56.101 (host-only) and 10.0.3.x/24 (NAT dhcp4). I'm using this netplan file:



     network:
    version: 2
    renderer: networkd
    ethernets:
    enp0s8:
    dhcp4: yes
    dhcp6: yes
    routes:
    - to: 0.0.0.0/0
    via: 10.0.3.2
    metric: 0
    enp0s3:
    dhcp4: no
    dhcp6: no
    addresses: [192.168.56.101/24]
    routes:
    - to: 192.168.56.1/24
    via: 192.168.56.1
    metric: 100


    With this I have only one default route, and it's using the NAT so it can reach the internet through my host.



    Output of ip r



    default via 10.0.3.2 dev enp0s8 proto dhcp src 10.0.3.15 metric 100
    10.0.3.0/24 dev enp0s8 proto kernel scope link src 10.0.3.15
    10.0.3.2 dev enp0s8 proto dhcp scope link src 10.0.3.15 metric 100
    192.168.56.0/24 dev enp0s3 proto kernel scope link src 192.168.56.10





    share|improve this answer

















    • 2




      Great answer! You indeed need to set up your own routing in this case. If both devices include a "default gateway" (ie. they specify "dhcp4" or "dhcp6", or set "gateway4"), then the system will set up both devices with a default gateway with the same metric. You won't need the route on enp0s3 however, since the "addresses" already contain the same /24 subnet as the one that would be used to access 192.168.56.1. Alternatively, set your own routing everywhere as you are doing.
      – Mathieu Trudel-Lapierre
      Mar 9 at 11:23













    up vote
    5
    down vote










    up vote
    5
    down vote









    I found this problem doing exactly the same thing this afternoon. Somehow managed to figure it out and netplan finally created only 1 default route through the NAT interface of my VM. In my case, both IP's were 192.168.56.101 (host-only) and 10.0.3.x/24 (NAT dhcp4). I'm using this netplan file:



     network:
    version: 2
    renderer: networkd
    ethernets:
    enp0s8:
    dhcp4: yes
    dhcp6: yes
    routes:
    - to: 0.0.0.0/0
    via: 10.0.3.2
    metric: 0
    enp0s3:
    dhcp4: no
    dhcp6: no
    addresses: [192.168.56.101/24]
    routes:
    - to: 192.168.56.1/24
    via: 192.168.56.1
    metric: 100


    With this I have only one default route, and it's using the NAT so it can reach the internet through my host.



    Output of ip r



    default via 10.0.3.2 dev enp0s8 proto dhcp src 10.0.3.15 metric 100
    10.0.3.0/24 dev enp0s8 proto kernel scope link src 10.0.3.15
    10.0.3.2 dev enp0s8 proto dhcp scope link src 10.0.3.15 metric 100
    192.168.56.0/24 dev enp0s3 proto kernel scope link src 192.168.56.10





    share|improve this answer













    I found this problem doing exactly the same thing this afternoon. Somehow managed to figure it out and netplan finally created only 1 default route through the NAT interface of my VM. In my case, both IP's were 192.168.56.101 (host-only) and 10.0.3.x/24 (NAT dhcp4). I'm using this netplan file:



     network:
    version: 2
    renderer: networkd
    ethernets:
    enp0s8:
    dhcp4: yes
    dhcp6: yes
    routes:
    - to: 0.0.0.0/0
    via: 10.0.3.2
    metric: 0
    enp0s3:
    dhcp4: no
    dhcp6: no
    addresses: [192.168.56.101/24]
    routes:
    - to: 192.168.56.1/24
    via: 192.168.56.1
    metric: 100


    With this I have only one default route, and it's using the NAT so it can reach the internet through my host.



    Output of ip r



    default via 10.0.3.2 dev enp0s8 proto dhcp src 10.0.3.15 metric 100
    10.0.3.0/24 dev enp0s8 proto kernel scope link src 10.0.3.15
    10.0.3.2 dev enp0s8 proto dhcp scope link src 10.0.3.15 metric 100
    192.168.56.0/24 dev enp0s3 proto kernel scope link src 192.168.56.10






    share|improve this answer













    share|improve this answer



    share|improve this answer











    answered Jan 12 at 0:45









    alfonso.ss

    14114




    14114







    • 2




      Great answer! You indeed need to set up your own routing in this case. If both devices include a "default gateway" (ie. they specify "dhcp4" or "dhcp6", or set "gateway4"), then the system will set up both devices with a default gateway with the same metric. You won't need the route on enp0s3 however, since the "addresses" already contain the same /24 subnet as the one that would be used to access 192.168.56.1. Alternatively, set your own routing everywhere as you are doing.
      – Mathieu Trudel-Lapierre
      Mar 9 at 11:23













    • 2




      Great answer! You indeed need to set up your own routing in this case. If both devices include a "default gateway" (ie. they specify "dhcp4" or "dhcp6", or set "gateway4"), then the system will set up both devices with a default gateway with the same metric. You won't need the route on enp0s3 however, since the "addresses" already contain the same /24 subnet as the one that would be used to access 192.168.56.1. Alternatively, set your own routing everywhere as you are doing.
      – Mathieu Trudel-Lapierre
      Mar 9 at 11:23








    2




    2




    Great answer! You indeed need to set up your own routing in this case. If both devices include a "default gateway" (ie. they specify "dhcp4" or "dhcp6", or set "gateway4"), then the system will set up both devices with a default gateway with the same metric. You won't need the route on enp0s3 however, since the "addresses" already contain the same /24 subnet as the one that would be used to access 192.168.56.1. Alternatively, set your own routing everywhere as you are doing.
    – Mathieu Trudel-Lapierre
    Mar 9 at 11:23





    Great answer! You indeed need to set up your own routing in this case. If both devices include a "default gateway" (ie. they specify "dhcp4" or "dhcp6", or set "gateway4"), then the system will set up both devices with a default gateway with the same metric. You won't need the route on enp0s3 however, since the "addresses" already contain the same /24 subnet as the one that would be used to access 192.168.56.1. Alternatively, set your own routing everywhere as you are doing.
    – Mathieu Trudel-Lapierre
    Mar 9 at 11:23













    up vote
    2
    down vote













    For me removing gateway4 from configuration did the trick. With it configured I was also not able to ping internet.



    Here is my netPlan config if it can help others.



    Note: enp0s3 is for ssh via port forwarding and enp0s8 for static ip



    network:
    ethernets:
    enp0s3:
    addresses:
    dhcp4: true
    optional: true
    enp0s8:
    addresses: [192.168.10.20/24]
    dhcp4: no
    dhcp6: no
    nameservers:
    addresses: [8.8.8.8, 8.8.4.4]
    version: 2





    share|improve this answer

























      up vote
      2
      down vote













      For me removing gateway4 from configuration did the trick. With it configured I was also not able to ping internet.



      Here is my netPlan config if it can help others.



      Note: enp0s3 is for ssh via port forwarding and enp0s8 for static ip



      network:
      ethernets:
      enp0s3:
      addresses:
      dhcp4: true
      optional: true
      enp0s8:
      addresses: [192.168.10.20/24]
      dhcp4: no
      dhcp6: no
      nameservers:
      addresses: [8.8.8.8, 8.8.4.4]
      version: 2





      share|improve this answer























        up vote
        2
        down vote










        up vote
        2
        down vote









        For me removing gateway4 from configuration did the trick. With it configured I was also not able to ping internet.



        Here is my netPlan config if it can help others.



        Note: enp0s3 is for ssh via port forwarding and enp0s8 for static ip



        network:
        ethernets:
        enp0s3:
        addresses:
        dhcp4: true
        optional: true
        enp0s8:
        addresses: [192.168.10.20/24]
        dhcp4: no
        dhcp6: no
        nameservers:
        addresses: [8.8.8.8, 8.8.4.4]
        version: 2





        share|improve this answer













        For me removing gateway4 from configuration did the trick. With it configured I was also not able to ping internet.



        Here is my netPlan config if it can help others.



        Note: enp0s3 is for ssh via port forwarding and enp0s8 for static ip



        network:
        ethernets:
        enp0s3:
        addresses:
        dhcp4: true
        optional: true
        enp0s8:
        addresses: [192.168.10.20/24]
        dhcp4: no
        dhcp6: no
        nameservers:
        addresses: [8.8.8.8, 8.8.4.4]
        version: 2






        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered Jul 2 at 15:30









        Ahsan.Amin

        1211




        1211




















            up vote
            0
            down vote













            As a note, while I was struggling with this and VMware Fusion... If you have any 'gateway4' value specified, it will assume that as default for the interface, and it doesn't seem to respect the 'metric' option or having multiple .yaml files with a numbering sequence (01-netplan.yaml, 02-netplan.yaml, etc...) in my case 02 ended up being the 'first default', but that is my internal network so public internet was unreachable.






            share|improve this answer





















            • Hi Mike -- welcome to askubuntu. This would be better as a Comment under the question. You should move the text there and just delete this as it isn't intended to "answer" the question.
              – dpb
              Apr 11 at 3:35














            up vote
            0
            down vote













            As a note, while I was struggling with this and VMware Fusion... If you have any 'gateway4' value specified, it will assume that as default for the interface, and it doesn't seem to respect the 'metric' option or having multiple .yaml files with a numbering sequence (01-netplan.yaml, 02-netplan.yaml, etc...) in my case 02 ended up being the 'first default', but that is my internal network so public internet was unreachable.






            share|improve this answer





















            • Hi Mike -- welcome to askubuntu. This would be better as a Comment under the question. You should move the text there and just delete this as it isn't intended to "answer" the question.
              – dpb
              Apr 11 at 3:35












            up vote
            0
            down vote










            up vote
            0
            down vote









            As a note, while I was struggling with this and VMware Fusion... If you have any 'gateway4' value specified, it will assume that as default for the interface, and it doesn't seem to respect the 'metric' option or having multiple .yaml files with a numbering sequence (01-netplan.yaml, 02-netplan.yaml, etc...) in my case 02 ended up being the 'first default', but that is my internal network so public internet was unreachable.






            share|improve this answer













            As a note, while I was struggling with this and VMware Fusion... If you have any 'gateway4' value specified, it will assume that as default for the interface, and it doesn't seem to respect the 'metric' option or having multiple .yaml files with a numbering sequence (01-netplan.yaml, 02-netplan.yaml, etc...) in my case 02 ended up being the 'first default', but that is my internal network so public internet was unreachable.







            share|improve this answer













            share|improve this answer



            share|improve this answer











            answered Feb 23 at 1:47









            Mike Roy

            1




            1











            • Hi Mike -- welcome to askubuntu. This would be better as a Comment under the question. You should move the text there and just delete this as it isn't intended to "answer" the question.
              – dpb
              Apr 11 at 3:35
















            • Hi Mike -- welcome to askubuntu. This would be better as a Comment under the question. You should move the text there and just delete this as it isn't intended to "answer" the question.
              – dpb
              Apr 11 at 3:35















            Hi Mike -- welcome to askubuntu. This would be better as a Comment under the question. You should move the text there and just delete this as it isn't intended to "answer" the question.
            – dpb
            Apr 11 at 3:35




            Hi Mike -- welcome to askubuntu. This would be better as a Comment under the question. You should move the text there and just delete this as it isn't intended to "answer" the question.
            – dpb
            Apr 11 at 3:35












             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f984445%2fnetplan-configuration-on-ubuntu-17-04-virtual-machine%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            pylint3 and pip3 broken

            Missing snmpget and snmpwalk

            How to enroll fingerprints to Ubuntu 17.10 with VFS491