simple examples of how to

Monday, November 7, 2011

[Ubuntu] How to setup network interface

You can modify the interface script which is /etc/network/interfaces

In case you want to set static IP, example

$ cat /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 203.237.53.112
netmask 255.255.255.0
gateway 203.237.53.254


in command line, it has the same effect of
$ sudo ifconfig eth0 203.237.53.112/24
$ sudo route add default gw 203.237.53.254

In case you want to set DHCP

$ cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp


in command line, it has the same effect as follows
$ sudo dhclient eth0


No comments:

Post a Comment