A. To configure your network interfaces with ifconfig.
STATIC IP ADDRESS
#ifconfig interface_name ip_address netmask mask |
To configure the default gateway:
#route add default gateway ip_address dev interface_name |
DYNAMIC IP ADDRESS
#dhclient interface |
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 AND DUPLEX MODE
To check your speed and duplex mode settings:
#ethtool interface_name |
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: 0x000000ff (255)
Link detected: yes
To set the duplex mode:
#ethtool interface_name -s duplex full|half autoneg off |
#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 |
auto eth0 iface eth0 inet static address 192.168.1.15 netmask 255.255.255.0 gateway 192.168.1.1 |
auto eth0 iface eth0 inet dhcp |
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 |
#ifconfig interface |
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 |
Destination 192.168.1.0 0.0.0.0 | Gateway 0.0.0.0 192.168.1.1 | Genmask 255.255.255.0 0.0.0.0 | Flags U UG | MSS 0 0 | Window 0 0 | irtt 0 0 | Iface eth0 eth0 |
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 openmaniak.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 |
To see the name servers and the IP address - FQDN correspondence, use the dig command:
#dig openmaniak.com |
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10055
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;openmaniak.com. IN A
;; ANSWER SECTION:
openmaniak.com. 76839 IN A 84.16.81.23
;; Query time: 1 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Wed Apr 18 22:12:02 2007
;; MSG SIZE rcvd: 48
Top of the page
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" |
#export | grep PROXY |
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 |
To access your user's home directory:
#cd ~/ |
#vim .bashrc |
export HTTP_PROXY="http://login:password@proxy_address:proxy_port" export FTP_PROXY="ftp://login:password@proxy_address:proxy_port" |
#cat ~/.bashrc ¦ grep PROXY |
export FTP_PROXY="ftp://login:password@proxy_address:proxy_port"