Difference between revisions of "DHCP and network configuration"
(add debian network manager) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 72: | Line 72: | ||
network 192.168.0.0 | network 192.168.0.0 | ||
broadcast 192.168.0.255 | broadcast 192.168.0.255 | ||
− | + | # Google 8.8.8.8 8.8.4.4 | |
+ | # OpenDNS 208.67.222.222 208.67.220.220 | ||
+ | # https://www.opendns.com/home-internet-security/opendns-ip-addresses/ | ||
+ | dns-nameservers 208.67.222.222 208.67.220.220 | ||
+ | |||
## If you belong to a domain you can add a reference to it | ## If you belong to a domain you can add a reference to it | ||
dns-search smartcards.vehco.com | dns-search smartcards.vehco.com | ||
Line 85: | Line 89: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | ==Wifi== | ||
− | == | + | ===Debian network manager=== |
+ | |||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | su root | ||
+ | nm-connection-editor | ||
+ | </syntaxhighlight> | ||
Line 228: | Line 239: | ||
You should have 2 similar results: server1.example.com | You should have 2 similar results: server1.example.com | ||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 10:31, 4 October 2015
Hostname and network configuration + DHCP server
Contents
Network configuration
Get the current status
Get current IP @ and 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
# Google 8.8.8.8 8.8.4.4
# OpenDNS 208.67.222.222 208.67.220.220
# https://www.opendns.com/home-internet-security/opendns-ip-addresses/
dns-nameservers 208.67.222.222 208.67.220.220
## If you belong to a domain you can add a reference to it
dns-search smartcards.vehco.com
dns-domain smartcards.vehco.com
Then, restart configuration
/etc/init.d/networking restart
Wifi
Debian network manager
su root
nm-connection-editor
WEP
Edit:
vim /etc/network/interfaces
Add:
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
Hostname
Get hostname
Just run the following command:
hostname
Setup hostname
Hosts files
Edit configuration file
vim /etc/hosts
You should have something like that (for fixed IP):
127.0.0.1 localhost
127.0.1.1 myServerName.myDomain myServerName
# 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
Hostname
echo myServerName.domain.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