sudo nano /etc/network/interfaces
Change this-
auto eth0
iface eth0 inet dhcp
To your static ip-
auto eth0
iface eth0 inet static
address 192.168.0.3
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-search example.com
dns-nameservers 8.8.8.8 4.2.2.2
(You can omit the dns-search if you don't need a domain suffix,)
Simply restart your server. If you'd prefer not to, you can restart the networking with this command-
sudo ifdown eth0 && sudo ifup eth0
No comments:
Post a Comment