Monthly Archive: July 2019

After set up static public IP, make Ubuntu server ftp/ssh/apache accessible

Problem: after setting up a static IP in a router, the local network is working, but Ubuntu server cannot connect Internet and vice versa.

Solution(for Ubuntu 18.04):

First, use ifconfig to find out which interface using for connecting to the Internet. In my case my network interface is eno1

enter below command to check DHCP setting:

sudo vi /etc/network/interfaces

copy below content. Make sure replace the network interface eno1 with the one you are using:

auto eno1
iface eno1 inet dhcp

Second, install network setting tool netplan

apt install netplan -y

because start from Ubuntu 18.04, we don’t need /etc/init.d/networking but using netplan to configure. Edit /etc/netplan/01-netcfg.yaml

network:
        version: 2
        renderer: networkd
        ethernets:
                eno1:
                        dhcp4: no
                        addresses: [192.168.1.144/24]
                        gateway4: 192.168.1.1
                        nameservers:
                                addresses: [8.8.8.8]

192.168.1.144 will be your local server IP address. Then enter below command, you may need to press [Enter] to make the configuration changed and wait about 2 minutes:

sudo netplan apply
sudo ifdown eno1  && ifup eno1

At last, set up port forwarding on router