News:

The Latest electronic and computer Tips that work!

Main Menu

Setup Linux Router with 2 Nics

Started by branx86, November 03, 2016, 02:14:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

branx86

Turn off selinux
/etc/sysconfig/selinux
Choose disabled

sestenforce 0

/etc/sysconfig/netwok-script/ifcfg-eth1
Make sure this IP is your Gateway 192.168.1.1

/etc/sysctl.conf
net.ipv4.ip_forward=1

sysctl -p  /etc/sysctl.conf enables change

Setup Nating
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward

etc/sysconfig/network
FORWARD_IPV4=YES

etc/sysconfig/dhcpd
DHCPDARGS=eth1

etc/sysconfig/network
NETWORKING=yes
HOSTNAME=DHCP
GATEWAY=192.168.1.1


/etc/dhcpd/dhcpd.conf
Option domain-name "cbrandon.local";
Option domain-name-servers 192.168.1.1,8.8.8.8;
Default-lease-time 600;
Max-lease-time 7200;
Authoritative;
Log-facility local7;
#this is a very basic subnet
Subnet 192.168.1.0 netmask 255.255.255.0{
Range 192.168.1.1 192.168.1.250;
Option routers 192.168.1.1;
}

Service dhcpd start

route add -host 255.255.255.255 dev eth1
route delete default gw 192.168.1.1 eth1
route add default gw 192.168.1.1 eth0

chkconfig NetworkManager off
Service NetworkManager stop
Chkconfig network on
Service network restart

iptables -F      Deletes all rules
iptables -t nat -F
iptables -t mangle -F
iptables -X         Deletes all rules not default
iptables -t nat -X
iptables -t mangle -X


iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT