Jump to content

Przekierowanie Portu


 Share

Recommended Posts

Witam, mam linuxa redhat jako taki nie wiem jakby.. router

Robił mi go informatyk i nie za bardzo się orientuję w tym systemie. Próbuję już od dawien dawna przekierować porty do mojego adresu IP. Znalazłem program redir, ale on przekierowuje tylko jeden rodzaj portu, już nie pamiętam czy TCP czy UDP. Wiem tylko, że powinienem użyc iptables i że w googlach nie znalazłem pomocy :(

Jeżeli to sprawi jakąkolwiek pomoc załączam iptables -L:

[root@fire_wall root]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere           state ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere           state RELATED
ACCEPT     udp  --  anywhere             anywhere           state ESTABLISHED
ACCEPT     udp  --  anywhere             anywhere           state RELATED
ACCEPT     icmp --  anywhere             anywhere           icmp echo-request
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  192.168.1.100        192.168.1.1        tcp dpt:ssh state NEW
ACCEPT     tcp  --  192.168.1.100        anywhere           state NEW multiport dports ftp-data,ftp
ACCEPT     tcp  --  192.168.1.100        anywhere           state NEW multiport dports ftp-data,ftp
ACCEPT     tcp  --  192.168.1.118        192.168.1.1        tcp dpt:ssh state NEW
ACCEPT     tcp  --  192.168.1.119        192.168.1.1        tcp dpt:ssh state NEW
ACCEPT     tcp  --  anywhere             anywhere           tcp dpt:ssh state NEW
ACCEPT     tcp  --  anywhere             anywhere           state NEW multiport dports ftp-data,ftp
ACCEPT     tcp  --  192.168.1.3          anywhere           state NEW multiport dports ftp-data,ftp,http,7171
ACCEPT     udp  --  192.168.1.3          anywhere           state NEW multiport dports ftp-data,ftp,http,7171

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere           state ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere           state RELATED
ACCEPT     udp  --  anywhere             anywhere           state ESTABLISHED
ACCEPT     udp  --  anywhere             anywhere           state RELATED
ACCEPT     icmp --  anywhere             anywhere           state ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere           state RELATED
ACCEPT     udp  --  anywhere             anywhere           udp dpt:domain state NEW
ACCEPT     tcp  --  anywhere             anywhere           tcp dpt:domain state NEW
ACCEPT     icmp --  anywhere             anywhere           icmp echo-request
ACCEPT     tcp  --  192.168.0.0/16       anywhere           state NEW multiport dports http,ftp-data,ftp,ssh,smtp,pop3,https,pop3s
ACCEPT     tcp  --  192.168.0.0/16       anywhere           state NEW multiport dports 5302,1550,4569,9060
ACCEPT     tcp  --  192.168.0.0/16       anywhere           state NEW multiport dports 27960,27961,27962,27963,27964,27965
ACCEPT     tcp  --  192.168.0.0/16       anywhere           state NEW multiport dports 43594,43595,1626,27015,27016
ACCEPT     tcp  --  192.168.0.0/16       anywhere           state NEW multiport dports 27486,44405,44440,54321,65432
ACCEPT     tcp  --  192.168.0.0/16       anywhere           state NEW multiport dports 5579,55901,11111,ircd,12975
ACCEPT     tcp  --  192.168.0.0/16       anywhere           state NEW multiport dports 1194,7171
ACCEPT     udp  --  192.168.0.0/16       anywhere           state NEW multiport dports 1194,ntp,7171
ACCEPT     tcp  --  192.168.0.0/16       anywhere           state NEW multiport dports 4661,4662,4672,4242,5661,rwhois,9955
ACCEPT     udp  --  192.168.0.0/16       anywhere           state NEW multiport dports 4661,4662,4672,4242,5661,rwhois,9955
ACCEPT     tcp  --  192.168.0.0/16       anywhere           state NEW multiport dports mysql

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere           state ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere           state RELATED
ACCEPT     udp  --  anywhere             anywhere           state ESTABLISHED
ACCEPT     udp  --  anywhere             anywhere           state RELATED
ACCEPT     icmp --  anywhere             anywhere           icmp echo-request
ACCEPT     all  --  anywhere             anywhere

 

Chciałbym przekierować port UDP i TCP 7171 na adres ip 192.168.1.3

Link to comment
Share on other sites

Spróbuj:

 

iptables -A FORWARD -j ACCEPT -p tcp --dport 7171
iptables -A FORWARD -j ACCEPT -p udp --dport 7171
iptables -t nat -A PREROUTING -p tcp --dport 7171 -j DNAT --to 192.168.1.3:7171
iptables -t nat -A PREROUTING -p udp --dport 7171 -j DNAT --to 192.168.1.3:7171

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...