>> Edit article
이름
제목
패스워드
Linux를 설치하고 두개의 랜카드를 달아서 하나는 공인IP를 설정하고, 다른 하나는 10.10.11.7이라는 IP를 설정했습니다. 리눅스서버에 매스쿼레이딩을 설정하구.. 포트포워딩을 통해 내부의 또다른 컴에 win2000을 설치해서 웹서비를 이용하려고 합니다. 공인IP하나를 받아서 사용하는건 아니고 C Class의 IP가 있는데.. NAT라고 하는게 맞나요?? 그걸 이요해 보려고 하는 중입니다.. 아래는rc.local 파일 내용입니다. #!/bin/sh # if [ -f /etc/wow-release ]; then R=$(cat /etc/redhat-release) arch=$(uname -m) a="a" case "_$arch" in _a*) a="an";; _i*) a="an";; esac NUMPROC=`egrep -c "^cpu[0-9]+" /proc/stat` if [ "$NUMPROC" -gt "1" ]; then SMP="$NUMPROC-processor " if [ "$NUMPROC" = "8" -o "$NUMPROC" = "11" ]; then a="an" else a="a" fi fi echo "" > /etc/issue echo "$R" >> /etc/issue echo "Kernel $(uname -r) on $a $SMP$(uname -m)" >> /etc/issue # This will make issue.net in a more secure way echo "" > /etc/issue.net echo "$R" >> /etc/issue.net fi # keyboard speed setting KBD_BIN=/sbin/kbdrate if [ -f $KBD_BIN ]; then $KBD_BIN -s -r 30.0 -d 250 fi if [ -f /etc/rc.d/rc.local.mine ]; then . /etc/rc.d/rc.local.mine fi #rc.firewall script - Start IPMASQ and the firewall /etc/rc.d/rc.firewall 아래는 rc.firewall 파일입니다. #!/bin/sh # # rc.firewall - Initial SIMPLE IP Masquerade test for 2.1.x and 2.2.x kernels us ing IPCHAINS # # Load all required IP MASQ modules # # NOTE: Only load the IP MASQ modules you need. All current IP MASQ modules # are shown below but are commented out from loading. # Needed to initially load modules # /sbin/depmod -a # Supports the proper masquerading of FTP file transfers using the PORT method # /sbin/modprobe ip_masq_ftp # Supports the masquerading of RealAudio over UDP. Without this module, # RealAudio WILL function but in TCP mode. This can cause a reduction # in sound quality # #/sbin/modprobe ip_masq_raudio # Supports the masquerading of IRC DCC file transfers # #/sbin/modprobe ip_masq_irc # Supports the masquerading of Quake and QuakeWorld by default. This modules is # for for multiple users behind the Linux MASQ server. If you are going to pl ay # Quake I, II, and III, use the second example. # #Quake I / QuakeWorld (ports 26000 and 27000) #/sbin/modprobe ip_masq_quake # #Quake I/II/III / QuakeWorld (ports 26000, 27000, 27910, 27960) #/sbin/modprobe ip_masq_quake ports=26000,27000,27910,27960 # Supports the masquerading of the CuSeeme video conferencing software # #/sbin/modprobe ip_masq_cuseeme #Supports the masquerading of the VDO-live video conferencing software # #/sbin/modprobe ip_masq_vdolive #CRITICAL: Enable IP forwarding since it is disabled by default since # # Redhat Users: you may try changing the options in /etc/sysconfig/ne twork from: # # # FORWARD_IPV4=false # to # FORWARD_IPV4=true # echo "1" > /proc/sys/net/ipv4/ip_forward # Dynamic IP users: # # If you get your IP address dynamically from SLIP, PPP, or DHCP, enable this following # option. This enables dynamic-ip address hacking in IP MASQ, making the life # with Diald and similar programs much easier. # #echo "1" > /proc/sys/net/ipv4/ip_dynaddr # MASQ timeouts # # 2 hrs timeout for TCP session timeouts # 10 sec timeout for traffic after the TCP/IP "FIN" packet is received # 160 sec timeout for UDP traffic (Important for MASQ'ed ICQ users) # /sbin/ipchains -M -S 7200 10 160 # DHCP: For people who receive their external IP address from either DHCP or BO OTP # such as ADSL or Cablemodem users, it is necessary to use the following # before the deny command. The "bootp_client_net_if_name" should be repl aced # the name of the link that the DHCP/BOOTP server will put an address on to? # This will be something like "eth0", "eth1", etc. # # This example is currently commented out. # # #/sbin/ipchains -A input -j ACCEPT -i bootp_clients_net_if_name -s 0/0 67 -d 0/0 68 -p udp # Enable simple IP forwarding and Masquerading # # NOTE: The following is an example for an internal LAN address in the 192.168 .0.x # network with a 255.255.255.0 or a "24" bit subnet mask. # # Please change this network number and subnet mask to match your intern al LAN setup # #/sbin/ipchains -P forward DENY /sbin/ipchains -A forward -s 10.10.11.0/24 -j MASQ #/sbin/ipchains -A forward -i eth1 -d 10.10.11.0/24 #/sbin/ipchains -A forward -j MASQ -i eth0 -s 10.10.11.0/24 -d 0.0.0.0/0 #echo "Enabling IPPORTFW Redirection on the external LAN.." # #/usr/sbin/ipmasqadm portfw -f /usr/sbin/ipmasqadm portfw -a -P tcp -L 21*.20*.4*.78 80 -R 10.10.11.78 80 위와 같이 두개의 파일을 설정했습니다. 내부 컴에서 외부로의 접속이나 인터넷연결엔 아무문제가 없습니다. 문제는 포트포워딩을 한 부분이 되질 않습니다. 아래내용은 ifconfig -a의 결과입니다. eth0 Link encap:Ethernet HWaddr 00:A0:C9:A3:6C:71 inet addr:21*.20*.4*.11 Bcast:211.202.42.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8649 errors:0 dropped:0 overruns:0 frame:0 TX packets:4916 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 Interrupt:11 Base address:0xfcc0 eth1 Link encap:Ethernet HWaddr 00:A0:C9:D9:23:D2 inet addr:10.10.11.1 Bcast:10.10.11.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2358 errors:0 dropped:0 overruns:0 frame:0 TX packets:44 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 Interrupt:9 Base address:0xfce0 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.255.255.0 UP LOOPBACK RUNNING MTU:3924 Metric:1 RX packets:26 errors:0 dropped:0 overruns:0 frame:0 TX packets:26 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 아래는 netstat -rn의 결과입니다. Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 21*.20*.4*.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 127.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 lo 10.10.11.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 0.0.0.0 21*.20*.4*.1 0.0.0.0 UG 0 0 0 eth0 0.0.0.0 21*.20*.4*.1 0.0.0.0 UG 0 0 0 eth0 0.0.0.0 21*.20*.4*.1 0.0.0.0 UG 0 0 0 eth0 아래는 ipchains -L의 결과입니다. Chain input (policy ACCEPT): Chain forward (policy ACCEPT): target prot opt source destination ports MASQ all ------ 10.10.11.0/24 anywhere n/a Chain output (policy ACCEPT): 아래는 /usr/sbin/ipmasqadm portfw -l의 결과입니다. prot localaddr rediraddr lport rport pcnt pref TCP 21*.20*.4*.78 10.10.11.78 www www 10 10 리눅스가 셋팅되어 있는 컴의 eth0에 포워딩을 사용할 내부컴의 공인IP(웹서비스를 이용할)를 가상으로 잡아줘야 된다고 해서 eth0:0를 설정하고 21*.20*.4*.78의 IP를 잡아서 해봤는데도 되지 않습니다. 이유를 아시는분 설명 부탁드립니다. 지난 토요일부터 잠도 제대로 못 자고 하고 있는데 도무지 뭐가 문제인지 아직 초보수준이라 잘 모르겠습니다. 답변 부탁드립니다.
Copyleft
1999-2026 by
JSBoard Open Project
Theme Designed by
IDOO
All right reserved