Home > OS >  I want to write a shell script, need network access, a firewall is a barrier, how intelligent judgme
I want to write a shell script, need network access, a firewall is a barrier, how intelligent judgme

Time:10-29

I want to match all Linux system,

Centos, ubuntu, the best versions are available,
I mainly use centos 7. But it's also useful 6, two services are different, systemctl and service,
Is how to determine the iptables or firewalld,

or what command?
 
# general control
The function firewall_port {
# judgment is iptables or firewalld, call different function, add port/service
}

The function firewalld_port {
# if the judgment is systemctl or service, to operate the service
}

The function iptables_port {
# with ipv6, that can support the best, don't support it doesn't matter, anyway, there are few use the
}
  • Related