Linux as a router for public networks

Posted by nixnotwin on Server Fault See other posts from Server Fault or by nixnotwin
Published on 2011-11-22T11:16:39Z Indexed on 2011/11/22 17:58 UTC
Read the original article Hit count: 225

Filed under:
|
|
|
|

My ISP had given me a /30 network. Later, when I wanted more public ips, I requested for a /29 network. I was told to keep using my earlier /30 network on the interface which is facing ISP, and the newly given /29 network should be used on the other interface which connects to my NAT router and servers.

This is what I got from the isp:

WAN IP: 179.xxx.4.128/30
CUSTOMER IP : 179.xxx.4.130
ISP GATEWAY IP:179.xxx.4.129
SUBNET : 255.255.255.252

LAN IPS: 179.xxx.139.224/29
GATEWAY IP :179.xxx.139.225
SUBNET : 255.255.255.248  

I have a Ubuntu pc which has two interfaces. So I am planning to do the following:

eth0 will be given 179.xxx.4.130/30 gateway 179.xxx.4.129
eth1 will be given  179.xxx.139.225/29

And I will have the following in the /etc/sysctl.conf:

net.ipv4.ip_forward=1

These will be iptables rules:

iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

My clients which have the ips 179.xxx.139.226/29 and 179.xxx.139.227/29 will be made to use 179.xxx.139.225/29 as gateway.

Will this configuration work for me? Any comments? If it works, what iptables rules can I use to have a bit of security?

P.S. Both networks are non-private and there is no NATing.

© Server Fault or respective owner

Related posts about linux

Related posts about router