Setting Ubuntu server as router can't access internet

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








up vote
1
down vote

favorite












Im trying to simulate a network (router, firewall, PCs and server) with several virtual machines running Ubuntu Server. I have followed several tutorials, questions on this froum and so on but I can't get it working.



My setup



-> One virtual machine that is suppoused to be the router with 2 network interfaces



  1. enp0s3 -> connected with my machine (where I have internet)

  2. enp0s8 -> connected into a private network

-> One virtual machine that is suppoused to be the firewall with 3 network interfaces



  1. enp0s3 -> connected in the same private network


  2. the other 2 are for server and pc but not using them right now


So far I've got



/etc/network/interfaces device one (router)



auto enp0s3
iface enp0s3 inet dhcp


auto enp0s8
iface enp0s8 inet static
address 10.20.0.1
netmask 255.255.192.0
network 10.20.0.0
broadcast 10.20.63.255
gateway 10.20.0.1


iptable



Chain POSTROUTING (policy ACCEPT) 
target prot opt source destination
MASQUERADE ALL -- anywhere anywhere


I have aswell uncommented the line net.ipv4.ip_forward=1 in /etc/sysctl.conf



/etc/network/interfaces device two (firewall)



(I just copied the one that is connected with the router)



auto enp0s3
iface enp0s3 inet static
address 10.20.0.2
netmask 255.255.192.0
network 10.20.0.0
broadcast 10.20.63.255
gateway 10.20.0.1

.....


iptable is empty in this one (Im not sure if I have to set anything)



Router has connection with internet, both devices communicate with each other (ping).



My problem



I'm trying to Access google (ping 8.8.8.8) with my firewall device but it says:



connect: Network is unreachable


What am I missing? Why can't I Access the internet in my second device?



P.S: I have both adapters set in the same network in VirtualBox










share|improve this question





















  • The iptables output does not give enough information. If you have only masquerading without other iptables settings, that is not enough.
    – nobody
    Apr 1 at 19:35










  • its the only one I have, what else do I need?
    – Alex_Crw45
    Apr 1 at 20:35










  • I am not 100% sure any more, but I think you have to take care of established and related connections. Take a look here tldp.org/HOWTO/html_single/Masquerading-Simple-HOWTO and here billauer.co.il/ipmasq-html.html. Next is more detailed tutorial, where I learned iptables from frozentux.net/iptables-tutorial/iptables-tutorial.html. The data on iptables, you have provided does not give information about interfaces. Provide configuration or commands not just the part of output.
    – nobody
    Apr 3 at 5:15















up vote
1
down vote

favorite












Im trying to simulate a network (router, firewall, PCs and server) with several virtual machines running Ubuntu Server. I have followed several tutorials, questions on this froum and so on but I can't get it working.



My setup



-> One virtual machine that is suppoused to be the router with 2 network interfaces



  1. enp0s3 -> connected with my machine (where I have internet)

  2. enp0s8 -> connected into a private network

-> One virtual machine that is suppoused to be the firewall with 3 network interfaces



  1. enp0s3 -> connected in the same private network


  2. the other 2 are for server and pc but not using them right now


So far I've got



/etc/network/interfaces device one (router)



auto enp0s3
iface enp0s3 inet dhcp


auto enp0s8
iface enp0s8 inet static
address 10.20.0.1
netmask 255.255.192.0
network 10.20.0.0
broadcast 10.20.63.255
gateway 10.20.0.1


iptable



Chain POSTROUTING (policy ACCEPT) 
target prot opt source destination
MASQUERADE ALL -- anywhere anywhere


I have aswell uncommented the line net.ipv4.ip_forward=1 in /etc/sysctl.conf



/etc/network/interfaces device two (firewall)



(I just copied the one that is connected with the router)



auto enp0s3
iface enp0s3 inet static
address 10.20.0.2
netmask 255.255.192.0
network 10.20.0.0
broadcast 10.20.63.255
gateway 10.20.0.1

.....


iptable is empty in this one (Im not sure if I have to set anything)



Router has connection with internet, both devices communicate with each other (ping).



My problem



I'm trying to Access google (ping 8.8.8.8) with my firewall device but it says:



connect: Network is unreachable


What am I missing? Why can't I Access the internet in my second device?



P.S: I have both adapters set in the same network in VirtualBox










share|improve this question





















  • The iptables output does not give enough information. If you have only masquerading without other iptables settings, that is not enough.
    – nobody
    Apr 1 at 19:35










  • its the only one I have, what else do I need?
    – Alex_Crw45
    Apr 1 at 20:35










  • I am not 100% sure any more, but I think you have to take care of established and related connections. Take a look here tldp.org/HOWTO/html_single/Masquerading-Simple-HOWTO and here billauer.co.il/ipmasq-html.html. Next is more detailed tutorial, where I learned iptables from frozentux.net/iptables-tutorial/iptables-tutorial.html. The data on iptables, you have provided does not give information about interfaces. Provide configuration or commands not just the part of output.
    – nobody
    Apr 3 at 5:15













up vote
1
down vote

favorite









up vote
1
down vote

favorite











Im trying to simulate a network (router, firewall, PCs and server) with several virtual machines running Ubuntu Server. I have followed several tutorials, questions on this froum and so on but I can't get it working.



My setup



-> One virtual machine that is suppoused to be the router with 2 network interfaces



  1. enp0s3 -> connected with my machine (where I have internet)

  2. enp0s8 -> connected into a private network

-> One virtual machine that is suppoused to be the firewall with 3 network interfaces



  1. enp0s3 -> connected in the same private network


  2. the other 2 are for server and pc but not using them right now


So far I've got



/etc/network/interfaces device one (router)



auto enp0s3
iface enp0s3 inet dhcp


auto enp0s8
iface enp0s8 inet static
address 10.20.0.1
netmask 255.255.192.0
network 10.20.0.0
broadcast 10.20.63.255
gateway 10.20.0.1


iptable



Chain POSTROUTING (policy ACCEPT) 
target prot opt source destination
MASQUERADE ALL -- anywhere anywhere


I have aswell uncommented the line net.ipv4.ip_forward=1 in /etc/sysctl.conf



/etc/network/interfaces device two (firewall)



(I just copied the one that is connected with the router)



auto enp0s3
iface enp0s3 inet static
address 10.20.0.2
netmask 255.255.192.0
network 10.20.0.0
broadcast 10.20.63.255
gateway 10.20.0.1

.....


iptable is empty in this one (Im not sure if I have to set anything)



Router has connection with internet, both devices communicate with each other (ping).



My problem



I'm trying to Access google (ping 8.8.8.8) with my firewall device but it says:



connect: Network is unreachable


What am I missing? Why can't I Access the internet in my second device?



P.S: I have both adapters set in the same network in VirtualBox










share|improve this question













Im trying to simulate a network (router, firewall, PCs and server) with several virtual machines running Ubuntu Server. I have followed several tutorials, questions on this froum and so on but I can't get it working.



My setup



-> One virtual machine that is suppoused to be the router with 2 network interfaces



  1. enp0s3 -> connected with my machine (where I have internet)

  2. enp0s8 -> connected into a private network

-> One virtual machine that is suppoused to be the firewall with 3 network interfaces



  1. enp0s3 -> connected in the same private network


  2. the other 2 are for server and pc but not using them right now


So far I've got



/etc/network/interfaces device one (router)



auto enp0s3
iface enp0s3 inet dhcp


auto enp0s8
iface enp0s8 inet static
address 10.20.0.1
netmask 255.255.192.0
network 10.20.0.0
broadcast 10.20.63.255
gateway 10.20.0.1


iptable



Chain POSTROUTING (policy ACCEPT) 
target prot opt source destination
MASQUERADE ALL -- anywhere anywhere


I have aswell uncommented the line net.ipv4.ip_forward=1 in /etc/sysctl.conf



/etc/network/interfaces device two (firewall)



(I just copied the one that is connected with the router)



auto enp0s3
iface enp0s3 inet static
address 10.20.0.2
netmask 255.255.192.0
network 10.20.0.0
broadcast 10.20.63.255
gateway 10.20.0.1

.....


iptable is empty in this one (Im not sure if I have to set anything)



Router has connection with internet, both devices communicate with each other (ping).



My problem



I'm trying to Access google (ping 8.8.8.8) with my firewall device but it says:



connect: Network is unreachable


What am I missing? Why can't I Access the internet in my second device?



P.S: I have both adapters set in the same network in VirtualBox







networking iptables router






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 1 at 16:46









Alex_Crw45

61




61











  • The iptables output does not give enough information. If you have only masquerading without other iptables settings, that is not enough.
    – nobody
    Apr 1 at 19:35










  • its the only one I have, what else do I need?
    – Alex_Crw45
    Apr 1 at 20:35










  • I am not 100% sure any more, but I think you have to take care of established and related connections. Take a look here tldp.org/HOWTO/html_single/Masquerading-Simple-HOWTO and here billauer.co.il/ipmasq-html.html. Next is more detailed tutorial, where I learned iptables from frozentux.net/iptables-tutorial/iptables-tutorial.html. The data on iptables, you have provided does not give information about interfaces. Provide configuration or commands not just the part of output.
    – nobody
    Apr 3 at 5:15

















  • The iptables output does not give enough information. If you have only masquerading without other iptables settings, that is not enough.
    – nobody
    Apr 1 at 19:35










  • its the only one I have, what else do I need?
    – Alex_Crw45
    Apr 1 at 20:35










  • I am not 100% sure any more, but I think you have to take care of established and related connections. Take a look here tldp.org/HOWTO/html_single/Masquerading-Simple-HOWTO and here billauer.co.il/ipmasq-html.html. Next is more detailed tutorial, where I learned iptables from frozentux.net/iptables-tutorial/iptables-tutorial.html. The data on iptables, you have provided does not give information about interfaces. Provide configuration or commands not just the part of output.
    – nobody
    Apr 3 at 5:15
















The iptables output does not give enough information. If you have only masquerading without other iptables settings, that is not enough.
– nobody
Apr 1 at 19:35




The iptables output does not give enough information. If you have only masquerading without other iptables settings, that is not enough.
– nobody
Apr 1 at 19:35












its the only one I have, what else do I need?
– Alex_Crw45
Apr 1 at 20:35




its the only one I have, what else do I need?
– Alex_Crw45
Apr 1 at 20:35












I am not 100% sure any more, but I think you have to take care of established and related connections. Take a look here tldp.org/HOWTO/html_single/Masquerading-Simple-HOWTO and here billauer.co.il/ipmasq-html.html. Next is more detailed tutorial, where I learned iptables from frozentux.net/iptables-tutorial/iptables-tutorial.html. The data on iptables, you have provided does not give information about interfaces. Provide configuration or commands not just the part of output.
– nobody
Apr 3 at 5:15





I am not 100% sure any more, but I think you have to take care of established and related connections. Take a look here tldp.org/HOWTO/html_single/Masquerading-Simple-HOWTO and here billauer.co.il/ipmasq-html.html. Next is more detailed tutorial, where I learned iptables from frozentux.net/iptables-tutorial/iptables-tutorial.html. The data on iptables, you have provided does not give information about interfaces. Provide configuration or commands not just the part of output.
– nobody
Apr 3 at 5:15
















active

oldest

votes











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%2f1021094%2fsetting-ubuntu-server-as-router-cant-access-internet%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1021094%2fsetting-ubuntu-server-as-router-cant-access-internet%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