Kick start Ubuntu

Just installed Ubuntu Server on my HP N54L Gen7 server.

Here is some essential things to perform.

Firewall

First thing first, firewall is always the most concerns.

Login to the console directly, I mean directly, not through ssh/telnet.

# sudo ufw reset
# sudo ufw default deny incoming
# sudo ufw default allow outgoing
# sudo ufw allow proto tcp from 192.168.1.10 to 192.168.1.66 port 22
# sudo ufw allow proto tcp from 192.168.1.11 to 192.168.1.66 port 22
# sudo ufw alow 1194/udp

The rules above reset the firewall rule then add the rules below

  • Deny all incoming traffic
  • Allow all outgoing traffic
  • All SSH from 192.168.1.10 and 192.168.1.11, assume server IP is 192.168.1.66
  • All incoming openvpn traffic running on port 1194 protocol udp

My N54L have the static IP of 192.168.1.66.

To enable ufw

# sudo ufw enable

To review a list of active rules

# sudo ufw status

To enable the firewall rules after every reboot, edit the file

/etc/rc.local

at the line below before the line ‘exit 0’

/lib/ufw/ufw-init start

This line MUST above ‘exit 0’


IP Masquerading

# sudo vi /etc/default/ufw

DEFAULT_FORWARD_POLICY=“ACCEPT”

# sudo vi /etc/ufw/sysctl.conf

uncomment net/ipv4/ip_forward=1

#sudo vi /etc/ufw/before.rules

add the lines At THE END of the file, must below the line ‘COMMIT’

# nat Table rules
*nat
:POSTROUTING ACCEPT [0:0]

# Forward traffic from eth1 through eth0.
#-A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
COMMIT

Restart firewall

# sudo ufw disable && sudo ufw enable



Leave a Reply

Your email address will not be published. Required fields are marked *