Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Jan 2012
Sharing network connection between two nics in one box .centos
what I need to do is:
I have a centos box with two nics
eth0 is connected to the network.
eth1 I want to connect to a router and connect 3 more machines to it.
I want the Centos box to give internet access to the router and the other 3 pc's but I don't want anyone from the outside world to be able to reach the little network.
- Join Date
- May 2011
Familiarize yourself with the Firewall provided by the Linux kernel (a.k.a. iptables/netfilter). You can do all that you mention with it. There is a graphical utility that can get you started, but a lot of the commands you'll have to work out yourself, experimentation is key here.
The software is probably already installed on your system:
man iptables man iptables-save
/etc/init.d/iptables stop /etc/init.d/iptables start
Keep in mind that to do routing, you'll need to enable TCP forwarding. You can do this in the /etc/sysctl.conf file.
First thing you need to do is turn on FORWARDing on the Linux box.
sysctl -w net.ipv4.ip_forward=1
in sysctl.conf change
net.ipv4.ip_forward = 0
net.ipv4.ip_forward = 1
A simple firewall could be;
iptables -P INPUT DROP iptables -P OUTPUT DROP iptables -P FORWARD DROP iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -i eth1 -m state --state NEW -j ACCEPT iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A OUTPUT -m state --state NEW -j ACCEPT iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A FORWARD -i eth1 -o eth0 - state --state NEW -j ACCEPT
The adventure of a life time.
Linux User #296285