반응형
First verify that Tomcat is running on port 8080. Run the following command
# netstat -ntl
The output will look something like
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN tcp 0 0 :::8009 :::* LISTEN tcp 0 0 :::8080 :::* LISTEN tcp 0 0 :::22 :::* LISTEN
Run the following command to redirect port 80 traffic to port 8080
# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
Run the folloing command to verify that redirect is working fine
# iptables -t nat -L
The output will look something like
Chain PREROUTING (policy ACCEPT) target prot opt source destination REDIRECT tcp -- anywhere anywhere tcp dpt:http redir ports 8080 Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain POSTROUTING (policy ACCEPT) target prot opt source destination
Run the following command to remove the routing
# iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
다른 방법 아래
/etc/sysconfig/iptables
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
반응형
'IT' 카테고리의 다른 글
umask 설정 (0) | 2013.09.14 |
---|---|
centos openssh 소스 컴파일시 zlib error (0) | 2013.09.14 |
iptables (0) | 2013.09.14 |
톰켓 시작 데몬 등록 (0) | 2013.09.14 |
솔라리스 reboot 없이 네트웍 재시작 (0) | 2013.09.11 |