Автор Тема: Настройка на компютър да рутира интернет връзка  (Прочетена 1164 пъти)

blackpearl

  • Напреднали
  • *****
  • Публикации: 85
    • Профил
Здравейте! Искам да попитам как мога да настроя една машина да рутира връзката на 2 компютъра. Имам съответно 2 лан карти + вградената която ще е input но много неща не са ми ясни... Машината ще е на Cent Os.

Също да попитам "DMZ" настройката как ще се прави?
Активен

n00b

  • Напреднали
  • *****
  • Публикации: 1248
  • Distribution: OSX
  • Window Manager: 10.6, 10.8, 10.9
  • Live to hack, hack to live.
    • Профил
Първо активираш forwarding-a:
http://www.ducea.com/2006/08/01/how-to-enable-ip-forwarding-in-linux/

после това:

#---------------------------------------------------------------
# Load the NAT module
#
# Note: It is best to use the /etc/rc.local example in this
#       chapter. This value will not be retained in the
#       /etc/sysconfig/iptables file. Included only as a reminder.
#---------------------------------------------------------------
 
modprobe iptable_nat

#---------------------------------------------------------------
# Enable routing by modifying the ip_forward /proc filesystem file
#
# Note: It is best to use the /etc/sysctl.conf example in this
#       chapter. This value will not be retained in the
#       /etc/sysconfig/iptables file. Included only as a reminder.
#---------------------------------------------------------------
 
echo 1 > /proc/sys/net/ipv4/ip_forward
 
#---------------------------------------------------------------
# Allow masquerading
# - Interface eth0 is the internet interface
# - Interface eth1 is the private network interface
#---------------------------------------------------------------
 
iptables -A POSTROUTING -t nat -o eth0 -s 192.168.1.0/24 -d 0/0 \
         -j MASQUERADE
 
#---------------------------------------------------------------
# Prior to masquerading, the packets are routed via the filter
# table's FORWARD chain.
# Allowed outbound: New, established and related connections
# Allowed inbound : Established and related connections
#---------------------------------------------------------------
 
iptables -A FORWARD -t filter -o eth0 -m state \
         --state NEW,ESTABLISHED,RELATED -j ACCEPT
 
iptables -A FORWARD -t filter -i eth0 -m state \
         --state ESTABLISHED,RELATED -j ACCEPT




Остана само да направиш машината да ръси адреси (dhcp) през eth1. За това аз използвам dnsmasq за целта.
След това налагаш eth0 да има интернет - в 99% е pppoe и си готов.
Активен

mobilio - професионални мобилни приложения

blackpearl

  • Напреднали
  • *****
  • Публикации: 85
    • Профил
Много благодаря!
Активен