Hi ,
I am Ben, I need to configure centos 6 as Nat router.
I mean to say I have six private ip ad 6 public ip now i need to configure cent os 6 as NAT router.
Please tell me any one how can i do this one task.
Thanks,
Ben
Can work Cent OS as Nat router
- eugene.ievlev
- Posts: 19
- Joined: 2014/02/07 10:41:03
- Location: Ukraine
- Contact:
Re: Can work Cent OS as Nat router
Hi,
First of all - check net.ipv4.ip_forward setting in /etc/sysctl.conf
For configuration of routing you can use command - route, for checking - netstat.
Configuration files which can help you:
/etc/sysconfig/network-scripts/ifcfg-eth{your interface} This file contains your network card settings
/etc/sysconfig/network This file contains various other settings, mainly the hostname and gateway
/etc/resolv.conf This file contains our search domain and nameservers
/etc/hosts Hostname and other entries for local machines not in DNS
Next big step - configuration iptables for configuration of NAT (like default solution).
Read mans, and good luck!
First of all - check net.ipv4.ip_forward setting in /etc/sysctl.conf
For configuration of routing you can use command - route, for checking - netstat.
Configuration files which can help you:
/etc/sysconfig/network-scripts/ifcfg-eth{your interface} This file contains your network card settings
/etc/sysconfig/network This file contains various other settings, mainly the hostname and gateway
/etc/resolv.conf This file contains our search domain and nameservers
/etc/hosts Hostname and other entries for local machines not in DNS
Next big step - configuration iptables for configuration of NAT (like default solution).
Read mans, and good luck!
Re: Can work Cent OS as Nat router
For the 2.5^15th time :: Better Details = Better Answers
Re: Can work Cent OS as Nat router
Dear eugene,
Thanks and very much for helpful support.
i have configure cent os as per you information now
I have one hp hardware and there is two nick card and,
I have configure two nick card eth0 for ISP and eth1 for lan interface and i have configure as below please check.
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables --flush
iptables -A FORWARD -i eth0 -j ACCEPT
iptables -A FORWARD -o eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A PREROUTING -t nat -d 18.22.26.22 -i eth0 -j DNAT --to-destination 192.168.1.64
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.1.64 -j SNAT --to 18.22.26.22
iptables -t nat -L -n -v
Thanks,
Ben
Thanks and very much for helpful support.
i have configure cent os as per you information now
I have one hp hardware and there is two nick card and,
I have configure two nick card eth0 for ISP and eth1 for lan interface and i have configure as below please check.
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables --flush
iptables -A FORWARD -i eth0 -j ACCEPT
iptables -A FORWARD -o eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A PREROUTING -t nat -d 18.22.26.22 -i eth0 -j DNAT --to-destination 192.168.1.64
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.1.64 -j SNAT --to 18.22.26.22
iptables -t nat -L -n -v
Thanks,
Ben
-
- Posts: 10642
- Joined: 2005/08/05 15:19:54
- Location: Northern Illinois, USA
Re: Can work Cent OS as Nat router
Just buy a router.
Your chances of building a secure router are slim.
Your chances of building a secure router are slim.
Re: Can work Cent OS as Nat router
Dear Sir,
I have one router but steel i need to configure centos as well as.
Can i do this imp task.
Thanks,
Ben
I have one router but steel i need to configure centos as well as.
Can i do this imp task.
Thanks,
Ben
- eugene.ievlev
- Posts: 19
- Joined: 2014/02/07 10:41:03
- Location: Ukraine
- Contact:
Re: Can work Cent OS as Nat router
Hi Ben,nikhil wrote: modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables --flush
iptables -A FORWARD -i eth0 -j ACCEPT
iptables -A FORWARD -o eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A PREROUTING -t nat -d 18.22.26.22 -i eth0 -j DNAT --to-destination 192.168.1.64
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.1.64 -j SNAT --to 18.22.26.22
iptables -t nat -L -n -v
Seems good. But configuration of firewall is individual for each case. And i don't recommend open all ports
Good luck,
Eugene