2015-02-06 7 views
-3

나는 로컬 서버 클러스터를 구축하고있다.iptables를 사용하는 리눅스 설정 게이트웨이

server2 eth0 IP:168.168.1.2 
       Gateway: 168.168.1.1 
       NETMASK: 255.255.0.0 
server3: eth0 IP: 168.168.1.3 
       Gateway: 168.168.1.1 
       NETMASK: 255.255.0.0 
server1: eth0 IP: 168.168.1.1 
      eth0:1 IP x.x.x.x(provided by ISP) 
       GATWWAY x.x.x.x(provided by ISP) 

서버 1을 서브넷의 게이트웨이로 구축하려고합니다. 그리고 server1의 공용 네트워크에 성공적으로 액세스 할 수 있습니다. 그러나 server2에서는 실패합니다. 나는 서버 1에 내 구성 뭐가 잘못 서버 2

#ping 173.194.127.240 
    PING 173.194.127.240 (173.194.127.240) 56(84) bytes of data. 
    From 168.168.1.1: icmp_seq=2 Redirect Host(New nexthop: x.x.x.x(ISP gateway)) 
    From 168.168.1.1: icmp_seq=3 Redirect Host(New nexthop: x.x.x.x(ISP gateway)) 
    From 168.168.1.1: icmp_seq=4 Redirect Host(New nexthop: x.x.x.x(ISP gateway)) 

    --- 173.194.127.240 ping statistics --- 
    6 packets transmitted, 0 received, 100% packet loss, time 5950ms 

에 서버 1

#iptables -t nat -F 
#iptables -t nat -A POSTROUTING -s 168.168.0.0/16 -o eth0:1 -j MASQUERADE 
#iptables -t nat -A POSTROUTING -o eth0:1 -j MASQUERADE 

#iptables -t nat -L 

    Chain PREROUTING (policy ACCEPT) 
    target  prot opt source    destination 

    Chain POSTROUTING (policy ACCEPT) 
    target  prot opt source    destination 
    MASQUERADE all -- anywhere    anywhere 

    Chain OUTPUT (policy ACCEPT) 
    target  prot opt source    destination 


    #iptables -L 
    Chain INPUT (policy ACCEPT) 
    target  prot opt source    destination 

    Chain FORWARD (policy ACCEPT) 
    target  prot opt source    destination 
    ACCEPT  all -- anywhere    anywhere 

    Chain OUTPUT (policy ACCEPT) 
    target  prot opt source    destination 

    Chain LOGGING (0 references) 
    target  prot opt source    destination 

에서 다음 명령을 실행합니다. iptables를 사용하여 게이트웨이를 어떻게 설정해야합니까? 많은 감사

+0

a)이 질문은 주제와 관련이 없으며 http://www.serverfault.com에 속해 있습니다. b) 나는 20 년의 경험을 가진 시스템 관리자이며, iptables를 직접 다루거나 신경 쓰지 않을 것입니다. 왜냐하면 내가 잘못되었거나 어리석은 일을 할 가능성이 있기 때문입니다. [Tom Eastep의 우수한 * Shorewall *] (http://shorewall.net) 또는 [firewalld] (https://fedoraproject.org/wiki/FirewallD)와 같은 것을 사용하도록 강력히 권장합니다 (RedHat 계열 시스템에만 해당). 당신의 유스 케이스에, 나는 Shorewall을 줄곧 사용하고 싶다. –

답변

0

동일한 인터페이스에서 LAN 및 WAN IP 주소를 모두 사용하는 것은 좋지 않습니다. WAN 연결 (예 : eth1)을 위해 새 NIC를 설치하는 것이 좋습니다. 구성이 정상적으로 보입니다. 새 NIC를 설치 한 후 eth0 : 1 대신 eth1을 사용하십시오.

+0

그것은 작동합니다. 고맙습니다. – user2256235