Linux: Setup: Firewalls - eliminmax/cncs-journal GitHub Wiki
Meaning of different command prompts
Unix/Linux:$
: can be run as normal user
Unix/Linux:#
: must be run as root (or withsudo
)
Windows:>
: Command Prompt or PowerShell
Windows:PS>
: PowerShell only
Unix/Linux and Windows:$/>
,#/>
: Works in Windows and Unix/Linux.
Note:
By default, firewall-cmd
makes changes to the running config, rather than the saved config.
If it is called with the --permanent
flag, it does the opposite - it changes the saved
config, but not the running config. To update both, call it with the --permanent
flag, then
call # firewall-cmd --reload
to reload from the saved config, or call the command twice,
once with the --permanent
flag, and once without. The latter method is usually better, as
the former will cause you to lose any deliberately-introduced differences between the running
and saved configs.
# firewall-cmd --list-all
Allow inbound tcp connections to port 22:
# firewall-cmd --add-port=22/tcp
# firewall-cmd --add-service=ssh
A few examples modified from ComputerNetworkingNotes
# firewall-cmd --add-rich-rule='rule family=ipv4 source address=192.0.2.0/24 service name=ssh log prefix="SSH Access" level="notice" accept'
`# firewall-cmd --add-rich-rule='rule protocol value=icmp reject'