Skip to content

Share internet in a SERVER connected to WAN port.

Hello,

The last days I keep trying to configure my server. I know how to configure the network to this:

MODEM -> (eth0) Servidor (eth1) -> (LAN Port) Router (LAN Ports) -> Computers

This topology don`t work for me, because in this way I lost one WAN Port. So I thought in this topology:

MODEM -> (eth0) Servidor (eth1) -> (Porta WAN) Router (Portas LAN) -> Computadoresauto eth1
iface eth1 inet static
address 192.168.100.254
netmask 255.255.255.0
network 192.168.100.0
broadcast 192.168.100.255

After this I add this iptables rules:

sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING --out-interface eth0 -j MASQUERADE
iptables -A FORWARD --in-interface eth0 -j ACCEPT

I need to setup the router manually:

IP Address : 192.168.100.1
Subnet Mask : 255.255.255.0
ISP Gateway Address : 192.168.100.254
Primary DNS Address : 200.247.141.11 (DNS)
Secondary DNS Address : 200.247.141.12 (DNS)

So up and running

Matheus

Published inAprendendoLinux

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.