[IT 알아보기]/IT 소식

IP forward 방법

이호스트ICT 2011. 5. 3. 10:13

Echo “1” >/proc/sys/net/ipv4/ip_forward

기본 0 설정 1로 변경

 

Rc.local 파일

 

/etc/run.sh

 

ifconfig eth0:0 61.97.255.56 netmask 255.255.255.224 broadcast 61.97.255.63 up

ifconfig eth0:1 61.97.255.57 netmask 255.255.255.224 broadcast 61.97.255.63 up

ifconfig eth0:2 61.97.255.58 netmask 255.255.255.224 broadcast 61.97.255.63 up

ifconfig eth0:3 61.97.255.59 netmask 255.255.255.224 broadcast 61.97.255.63 up

 

/etc/run.sh

1 #!/bin/bash

  2

  3 iptables -t nat -F

  4

  5 iptables -t nat -A PREROUTING -d 110.45.143.194 -j DNAT --to 211.115.72.184

  6 iptables -t nat -A POSTROUTING -d 211.115.72.184 -j SNAT --to 110.45.143.194

  7

  8 iptables -t nat -A PREROUTING -d 110.45.143.195 -j DNAT --to 211.115.72.185

  9 iptables -t nat -A POSTROUTING -d 211.115.72.185 -j SNAT --to 110.45.143.195

 10

 11 iptables -t nat -A PREROUTING -d 110.45.143.196 -j DNAT --to 211.115.72.186

 12 iptables -t nat -A POSTROUTING -d 211.115.72.186 -j SNAT --to 110.45.143.196

 13

 14 iptables -t nat -A PREROUTING -d 110.45.143.197 -j DNAT --to 211.115.72.191

 15 iptables -t nat -A POSTROUTING -d 211.115.72.191 -j SNAT --to 110.45.143.197

 16

 17 iptables -t nat -A PREROUTING -d 110.45.143.198 -j DNAT --to 211.115.72.193

 18 iptables -t nat -A POSTROUTING -d 211.115.72.193 -j SNAT --to 110.45.143.198

 

설정 끝

 

Shell>iptables –t nat –L –v

 

Chain PREROUTING (policy ACCEPT 476 packets, 77208 bytes)

 pkts bytes target     prot opt in     out     source               destination        

   87  5536 DNAT       all  --  any    any     anywhere             110.45.143.194      to:211.115.72.184

 1790 88828 DNAT       all  --  any    any     anywhere             110.45.143.195      to:211.115.72.185

 1240 61084 DNAT       all  --  any    any     anywhere             110.45.143.196      to:211.115.72.186

  128  7052 DNAT       all  --  any    any     anywhere             110.45.143.197      to:211.115.72.191

  324 16836 DNAT       all  --  any    any     anywhere             110.45.143.198      to:211.115.72.193

 

Chain POSTROUTING (policy ACCEPT 406 packets, 29326 bytes)

 pkts bytes target     prot opt in     out     source               destination        

   87  5536 SNAT       all  --  any    any     anywhere             211.115.72.184      to:110.45.143.194

 1790 88828 SNAT       all  --  any    any     anywhere             211.115.72.185      to:110.45.143.195

 1240 61084 SNAT       all  --  any    any     anywhere             211.115.72.186      to:110.45.143.196

  128  7052 SNAT       all  --  any    any     anywhere             211.115.72.191      to:110.45.143.197

  324 16836 SNAT       all  --  any    any     anywhere             211.115.72.193      to:110.45.143.198


 

by .신

'[IT 알아보기] > IT 소식' 카테고리의 다른 글

도스(command)창에서 원격세션 끊기  (0) 2011.05.03
mysql character_set 변경  (0) 2011.05.03
vsftp.conf 설정  (0) 2011.05.03
3ware 레이드카드 명령어  (0) 2011.05.02
각종 문자역 검색방법  (0) 2011.05.02