2013-08-20 12:07:55 +0000 2013-08-20 12:07:55 +0000
34
34
Advertisement

heb iptables regel nodig om al het inkomende verkeer te accepteren

Advertisement

Voor mijn testomgeving wil ik al het inkomende verkeer accepteren, kan iemand mij de iptable regel geven om toe te voegen.

Mijn huidige iptables -L -n output ziet er als volgt uit

Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all – 0. 0.0.0/0 0.0.0.0/0 toestand RELATED,ESTABLISHED ACCEPT icmp – 0.0.0.0/0 0.0.0.0/0 ACCEPT all – 0.0.0.0/0 0.0.0/0 ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 toestand NEW tcp dpt:22 REJECT all – 0. 0.0.0/0 0.0.0.0/0 afwijzing-met icmp-gastheer-geboden ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:8443 ACCEPT tcp – 0. 0.0.0/0 0.0.0.0/0 tcp dpt: 8080 ACCEPT tcp – 0.0.0.0/0 0.0.0/0 tcp dpt: 9443 ACCEPT tcp – 0.0.0.0/0 0.0.0. 0/0 tcp dpt:2124

Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all – 0.0.0.0/0 0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT) target prot opt source destination

Bedankt.

Advertisement
Advertisement

Antwoorden (2)

54
54
54
2013-08-20 16:20:23 +0000

Voer het volgende uit. Het zal de regel bovenaan uw iptables invoegen en zal al het verkeer toestaan, tenzij het later door een andere regel wordt afgehandeld.

iptables -I INPUT -j ACCEPT

U kunt ook uw gehele iptables installatie doorspoelen met het volgende:

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

Als u het doorspoelt, wilt u misschien iets dergelijks uitvoeren:

iptables -A INPUT -i lo -j ACCEPT -m comment --comment "Allow all loopback traffic"
iptables -A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT -m comment --comment "Drop all traffic to 127 that doesn't use lo"
iptables -A OUTPUT -j ACCEPT -m comment --comment "Accept all outgoing"
iptables -A INPUT -j ACCEPT -m comment --comment "Accept all incoming"
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -m comment --comment "Allow all incoming on established connections"
iptables -A INPUT -j REJECT -m comment --comment "Reject all incoming"
iptables -A FORWARD -j REJECT -m comment --comment "Reject all forwarded"

Als je wat veiliger wilt zijn met je verkeer, gebruik dan niet de regel “Accepteer alle inkomende regels”, of verwijder deze met “iptables -D INPUT -j ACCEPT -m comment -commentaar "Accepteer alle inkomende”“, en voeg meer specifieke regels toe zoals:

iptables -I INPUT -p tcp --dport 80 -j ACCEPT -m comment --comment "Allow HTTP"
iptables -I INPUT -p tcp --dport 443 -j ACCEPT -m comment --comment "Allow HTTPS"
iptables -I INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT -m comment --comment "Allow SSH"
iptables -I INPUT -p tcp --dport 8071:8079 -j ACCEPT -m comment --comment "Allow torrents"

OPMERKING: Ze moeten boven de 2 afwijzingsregels aan de onderkant staan, dus gebruik ik om ze aan de bovenkant in te voegen. Of als je anaal bent zoals ik, gebruik dan "iptables -nL –lijnnummers” om de regelnummers te krijgen, gebruik dan “iptables -I INPUT …” om een regel in te voegen bij een specifiek regelnummer.

Tenslotte, sla je werk op met:

iptables-save > /etc/network/iptables.rules #Or wherever your iptables.rules file is
16
16
16
2013-08-20 13:24:49 +0000

om al het inkomende verkeer te accepteren kunt u het volgende commando gebruiken , -P is om standaard beleid in te stellen als accepteren

iptables -P INPUT ACCEPT

als u uw vorige regels niet nodig heeft, gewoon doorspoelen/verwijderen en dan bovenstaand commando gebruiken. om alle regels door te spoelen gebruik

iptables -F
Advertisement

Gerelateerde vragen

6
10
5
37
9
Advertisement