Difference between revisions of "DHCP and network configuration"
(Created page with "Hostname and network configuration =Get the current status= ==Get connection details== Display connection settings <syntaxhighlight lang="bash"> ifconfig </syntaxhighlig...") |
(No difference)
|
Revision as of 15:11, 21 May 2014
Hostname and network configuration
Contents
Get the current status
Get connection details
Display connection settings
ifconfig
if you have many network card you can filter using interface name (eth0 // eth1 // wlan0).
To get more details
ifconfig -a
Discover your gateway
route
Default gateway is named "default"
Setup DHCP / static IP @
By default the system is using DHCP.
Following procedure will set a fix IP.
Edit configuration file:
vim /etc/network/interfaces
Adjust the file like this:
# The loopback network interface (127.0.0.1)
auto lo
iface lo inet loopback
# The primary network interface [DHCP]
#allow-hotplug eth0
#auto eth0
#iface eth0 inet dhcp
# The primary network interface [static IP]
auto eth0
iface eth0 inet static
address 192.168.0.100 # mandatory
netmask 255.255.255.0 # mandatory
gateway 192.168.0.1 # mandatory
network 192.168.0.0
broadcast 192.168.0.255
dns-nameservers 8.8.8.8 8.8.4.4 # Google DNS
Then, restart configuration
/etc/init.d/networking restart
Wifi
WEP
Edit:
vim /etc/network/interfaces
Add:
Wifi configuration [WEP]
auto wlan0
iface wlan0 inet dhcp
wireless-essid NUMERICABLE-F164
wireless-key f4c1dc12023b916d309c2561cb
wireless-channel 11
wireless-mode managed
WPA
Required software
You must install wpa supplicant
apt-get install wpasupplicant
Restrict the permissions of interfaces configuration to prevent code disclosure:
chmod 0600 /etc/network/interfaces
Configuration
Edit
vim /etc/network/interfaces
Adjust like that:
auto wlan0
iface wlan0 inet dhcp
wpa-ssid ssid
wpa-psk password
Take changes into account
Then, you have to start your wireless interface:
ifup wlan0
Restart configuration
/etc/init.d/networking restart
Setup hostname Hosts
Edit configuration file
- vi /etc/hosts
127.0.0.1 localhost.localdomain localhost 192.168.0.100 server1.example.com server1
- The following lines are desirable for IPv6 capable hosts
- 1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
Hostname
- echo server1.example.com > /etc/hostname
Take changes into account Reboot server
- shutdown -r now
Check result
- hostname
- hostname -f
You should have 2 similar results: server1.example.com