Firewall rules

Security Layer 6

Finally let us define the firewall rules for our server. For running Ethereum node you need to open port 30303 (TCP & UDP) and 9001 (TCP & UDP).

You can set up the firewall rules for your cloud server on your cloud service provider platform. But I personally prefer setting up using 'ufw' through command line interface. First let us check the status of the firewall.

sudo ufw status verbose

stauts: inactive

By default firewall is setup with 'deny incoming' and 'allow outgoing'. Now you can first define the firewall rules and then enable it or enable it first and then define the firewall rules. But I personally prefer defining firewall rules first and then enable it. Let's first open the ssh port 1234 and then ports for the Ethereum node.

sudo ufw allow 1234/tcp

Rules updated

Rules updated (v6)

sudo ufw allow 30303/tcp

Rules updated

Rules updated (v6)

sudo ufw allow 9001/tcp

Rules updated

Rules updated (v6)

sudo ufw enable

Command may disrupt existing ssh connection. Proceed with operation (y/n)? y

Firewall is active and enabled on system startup

Always remember to first change the default port 22 through which ssh connection has been made to port 1234 in 'sshd_config' file then only you must open port 1234 for incoming in ufw firewall settings, otherwise you may end up with trouble logging in to your server.

Last updated