Good afternoon folks,
I does have some problems to get work the next topology in all CentOS computers over VirtualBox:
My network:
I have a ISP's router with local area is set up as 192.168.1.0/24
My laptop does have 192.168.1.90
Server side VM:
CentOS with bridged network card -> enp0s3:
* 192.168.1.223/24
Internetwork card -> enp0s8
* 172.16.1.1/16
Client side VM:
Internetwork card -> enp0s3
* 172.16.1.10/16
ifcfg-enp0s3:
DEVICE=enp0s3
IPADDR=172.16.1.10
NETMASK=255.255.0.0
GATEWAY=172.16.1.1
GATEWAY_DEV=enp0s3
ONBOOT=yes
BOOTPROTO=static
NETWORKING=yes
At client side, I added this commands to add default route
route add -net 192.168.1.0 netmask 255.255.255.0 gw 172.16.1.1
I get this message when I execute ip route:
default via 172.16.1.1 dev enps03 proto static metric 100
172.16.0.0/16 dev enp0s3 proto kernel scope link src 172.16.1.10 metric 100
192.168.1.0/24 via 172.16.1.1 dev enp0s3
When I do ping to Server from Client, It's works.
But when I try to ping my laptop computer 192.168.1.90 or gateway 192.168.1.1 that's does not work.
What am I doing bad?
[Solved] How I can setup this topology over CentOS?
-
- Posts: 3
- Joined: 2017/08/23 00:21:02
[Solved] How I can setup this topology over CentOS?
Last edited by sincorchetes on 2018/01/22 00:20:34, edited 1 time in total.
-
- Posts: 2019
- Joined: 2015/02/17 15:14:33
- Location: Bulgaria
- Contact:
Re: How I can setup this topology over CentOS?
What is the output of this (run on CentOS Server VM):
Code: Select all
sysctl net.ipv4.ip_forward
-
- Posts: 3
- Joined: 2017/08/23 00:21:02
Re: How I can setup this topology over CentOS?
Yes, I made that but It's does not work.hunter86_bg wrote:What is the output of this (run on CentOS Server VM):Code: Select all
sysctl net.ipv4.ip_forward
I have to apply this:
Code: Select all
iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
Code: Select all
ping google.com
I have setup /etc/resolv.conf in the client side the same DNS servers as laptop and server (Works fine in both devices).
-
- Posts: 3
- Joined: 2017/08/23 00:21:02
Re: How I can setup this topology over CentOS?
Okay, It was solved:sincorchetes wrote:Yes, I made that but It's does not work.hunter86_bg wrote:What is the output of this (run on CentOS Server VM):Code: Select all
sysctl net.ipv4.ip_forward
I have to apply this:Now, I can do ping from client into 8.8.8.8, but I cannot perform:Code: Select all
iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
Because It does not find servers.Code: Select all
ping google.com
I have setup /etc/resolv.conf in the client side the same DNS servers as laptop and server (Works fine in both devices).
Commands performed to solve this issue:
Code: Select all
sysctl net.ipv4.conf.all.forwarding=1
iptables -I FORWARD -o enp0s8 -j ACCEPT
iptables -I FORWARD -i enp0s8 -j ACCEPT
iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE