To force a DHCP renew, use:
dhclient
DHClient renews all interfaces by default, ignoring non-broadcast interfaces if possible. You can also specify interfaces like this:
dhclient eth0
To use ifconfig to reveal all interfaces, use:
ifconfig -a
To use ifconfig to set up interface, use:
ifconfig eth0 192.168.1.2
ifconfig eth0 netmask 255.255.255.0
route add default gw 192.168.1.1
ifconfig eth0 up
You can also configure sub-interfaces, like this:
ifconfig eth0:1 192.168.1.2
When Debian first starts, it reads:
/etc/network/interfaces
The file contains the available interfaces and how to configure them.
To permanently switch an interface to use static address, modify /etc/network/interfaces. You should see the following code:
iface eth0 inet dhcp
Change it to:
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
We can also add additional nameservers by modifying /etc/resolv.conf:
nameserver 192.168.1.1
You can also use ifup and ifdown to bring an interface up or down like this:
ifup eth0
ifdown eth0
Use the -a parameter to bring all up or down, like this:
ifdown -a
No comments :
Post a Comment