[Solved] How I can setup this topology over CentOS?

Issues related to configuring your network
Post Reply
sincorchetes
Posts: 3
Joined: 2017/08/23 00:21:02

[Solved] How I can setup this topology over CentOS?

Post by sincorchetes » 2018/01/21 18:04:45

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?
Last edited by sincorchetes on 2018/01/22 00:20:34, edited 1 time in total.

hunter86_bg
Posts: 1213
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: How I can setup this topology over CentOS?

Post by hunter86_bg » 2018/01/21 20:25:20

What is the output of this (run on CentOS Server VM):

Code: Select all

sysctl net.ipv4.ip_forward

sincorchetes
Posts: 3
Joined: 2017/08/23 00:21:02

Re: How I can setup this topology over CentOS?

Post by sincorchetes » 2018/01/22 00:03:27

hunter86_bg wrote:What is the output of this (run on CentOS Server VM):

Code: Select all

sysctl net.ipv4.ip_forward
Yes, I made that but It's does not work.

I have to apply this:

Code: Select all

iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
Now, I can do ping from client into 8.8.8.8, but I cannot perform:

Code: Select all

ping google.com
Because It does not find servers.

I have setup /etc/resolv.conf in the client side the same DNS servers as laptop and server (Works fine in both devices).

sincorchetes
Posts: 3
Joined: 2017/08/23 00:21:02

Re: How I can setup this topology over CentOS?

Post by sincorchetes » 2018/01/22 00:20:01

sincorchetes wrote:
hunter86_bg wrote:What is the output of this (run on CentOS Server VM):

Code: Select all

sysctl net.ipv4.ip_forward
Yes, I made that but It's does not work.

I have to apply this:

Code: Select all

iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
Now, I can do ping from client into 8.8.8.8, but I cannot perform:

Code: Select all

ping google.com
Because It does not find servers.

I have setup /etc/resolv.conf in the client side the same DNS servers as laptop and server (Works fine in both devices).
Okay, It was solved:

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

Post Reply