Open Port Permanently with firewalld in linux

linux, networking

First thing to do after installing a service that listening on your network interface is to test in your preferred internet browser.

However, if your firewalld is running, you will be getting a connection error message and this is how you should open it. Permanently.

# firewall-cmd --permanent --zone=public --add-port=<portNo>/tcp
# firewall-cmd --reload
# firewall-cmd --list-all

Explanation

  1. Configure the new rule to be implemented permanently, --permanent
  2. The rule is in specific zone, with specific port number and protocol, firewall-cmd --permanent --zone=public --add-port=/tcp
  3. To reload firewall-cmd with new rule, --reload
  4. Listing all rule in, --list-all

Note: Removing --permanent will caused it to take effect immediately, but the configuration is volatile!

Raspbian: Fallback to predefined IP if DHCP failed

linux, networking, raspbian

Bellow configuration taken from /etc/dhcpcd.conf file may look fine, but no. It is not.

# define static profile
profile static_eth0
static ip_address=169.254.65.72
static routers=169.254.65.72
static domain_name_servers=169.254.65.72

# fallback to static profile on eth0
interface eth0
fallback static_eth0

It is not because we assigned an Automatic Private IP address. Means, this range normally was used by the OS to assign IP whenever its connected to network, but DHCP service is not available.

Change the IP to something else from class A or class C.