Basic Network Setting Debian (English)
1. Network Settings
A. To configure your network interfaces with ifconfig.
- Static IP Address
#ifconfig [interface_name] [ip_address] netmask [mask]
ex :
#ifconfig eth0 192.168.1.15 netmask 255.255.255.0 broadcast 192.168.1.255
To configure the default gateway:
#route add default gateway [ip address] dev [interface_name]
ex :
#route add default gateway 192.168.1.1 dev eth0
- Dynamic IP Address
#dhclient [interface]
ex :
#dhclient eth0
Internet Systems Consortium DHCP Client V3.0.3
Copyright 2004-2005 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP
Listening on LPF/eth0/aa:00:11:22:33:44
Sending on LPF/eth0/aa:00:11:22:33:44
Sending on Socket/fallback
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.130 — renewal in 1002089 seconds.
- Speed dan Duplex Mode
To check your speed and duplex mode settings:
#ethtool [interface_name]
ex :
#ethtool eth0
Settings for eth0:
Supported ports: [ MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Half
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Current message level: 0×000000ff (255)
Link detected: yes
To set the duplex mode:
#ethtool [interface_name] -s duplex full | half autoneg off
To set the speed:
#ethtool [interface_name] -s 10|100|1000 autoneg off
To restore the default speed and duplex mode settings to automatic negotiation:
#ethtool [interface_name] -s autoneg on
B. To configure your network interfaces with permanent settings.
The commands above will not be kept if you reboot your computer or restart the networking service. To keep your network settings permanently, open the /etc/network/interfaces file:
#vim /etc/network/interfaces
- Static IP Address
auto eth0
iface eth0 inet static
address 192.168.1.15
netmask 255.255.255.0
gateway 192.168.1.1
- Dynamic IP Address
auto eth0
iface eth0 inet dhcp
- Speed, duplex mode & routing
auto eth0
iface eth0 inet static|dhcp
post-up /usr/bin/ethtool eth0 -s speed 100 duplex full autoneg off
post-up route add default gateway 192.168.1.1 dev eth0
2. Networking Checks
To see all your network interfaces settings:
#ifconfig -a
To check the settings of a particular interface:
#ifconfig [interface]
ex :
#ifconfig eth0
eth0 Link encap:Ethernet HWaddr AA:00:11:22:33:44
inet addr:192.168.1.15 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a800:4ff:0000:000/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1058 errors:0 dropped:0 overruns:0 frame:0
TX packets:638 errors:0 dropped:0 overruns:0 carrier:0
collisions:1 txqueuelen:1000
RX bytes:100716 (98.3 KiB) TX bytes:86309 (84.2 KiB)
Interrupt:169
To check your default gateway(s):
#route -n
3. DNS (Domain Name System)
The domain name system (DNS), with name servers, translates domain names or FQDN to IP addresses.
For example, to access the zulfanruri.com FQDN with a web browser such as Firefox, the website name is first translated into an IP address by a name server (DNS server).
The name servers IP addresses are stored in the /etc/resolv.conf file. If you get your IP address dynamically through a DHCP server, your name servers are generally automatically added in the file.
#vim /etc/resolv.conf
nameserver 192.168.1.1
Where 192.168.1.1 is the name server IP address.
To see the name servers and the IP address – FQDN correspondence, use the dig command:
#dig [namadomain]
4. Proxy
If you access the internet trough a proxy server, use the following settings:
#export HTTP_PROXY=”http://login:password@proxy_address:proxy_port”
#export FTP_PROXY=”ftp://login:passowrd@proxy_address:proxy_port”
To check your proxy settings:
#export | grep PROXY
declare -x export HTTP_PROXY=”http://login:password@proxy_address:proxy_port
declare -x export FTP_PROXY=”http://login:password@proxy_address:proxy_port
The settings configured above will be lost if you reboot your Linux.
So to configure the proxy settings permanently with the bash shell, proceed as follow:
To check the shell your are using:
#echo $SHELL
/bin/bash
To access your user’s home directory:
#cd ~/
To add your proxy settings in the hidden “.bashrc” file:
#vim .bashrc
export HTTP_PROXY=”http://login:password@proxy_address:proxy_port”
export FTP_PROXY=”ftp://login:password@proxy_address:proxy_port”
To check your proxy settings:
#cat ~/.bashrc ¦ grep PROXY
export HTTP_PROXY=”http://login:password@proxy_address:proxy_port”
export FTP_PROXY=”ftp://login:password@proxy_address:proxy_port”




