Skip to content

Instantly share code, notes, and snippets.

@mrtuborg
Last active August 29, 2015 14:16
Show Gist options
  • Save mrtuborg/d8659d65bcf7d2944468 to your computer and use it in GitHub Desktop.
Save mrtuborg/d8659d65bcf7d2944468 to your computer and use it in GitHub Desktop.
Fedora.md

firewall-cmd --get-default-zone firewall-cmd --list-all firewall-cmd --zone=public --add-service=http --permanent

#How to open http port 80 on Linux using firewall-cmd

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

And check whether the port was added to ipatables rules:

-A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT

hostnamectl hostnamectl set-hostname dlp.server.world

#How to close port 80 on Linux using firewall-cmd

'''# iptables-save | grep 80 -A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT

firewall-cmd --zone=public --remove-port=80/tcp --permanent

success

firewall-cmd --reload

success

iptables-save | grep 80

'''

#How to redirect port 8080 to 80 on Linux using firewall-cmd

'''firewall-cmd --permanent --zone=public --add-forward-port=port=80:proto=tcp:toport=8080 '''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment