________________________________
From: Darac Marjal <mailingl...@darac.org.uk>
To: debian-user@lists.debian.org
Sent: Tuesday, June 3, 2014 8:06 PM
Subject: Re: Post-installation: how to auto-configure network adapter (ie.
enable internet access)?
> OK, given your preference for keeping things to a minimum, you may as well do
> the following.
> If the connection is wired and DHCP is available:
> #0: apt-get install isc-dhcp-client (I'm assuming you have your install CD
> handy)
> #1: sudo dhclient eth0
> That should be enough to get you an IP, a nameserver and a default route. Try
> "ping -c1 google.com" or else "ping -c1 8.8.8.8". If the first fails,
> but the second works, append "namesever 8.8.8.8" to /etc/resolv.conf
> If the connection is wired, and DHCP is not available (i.e. a static IP is
> provided)
> #1: ip address add x.x.x.x/yy dev eth0
> #2: ip route add default via z.z.z.z dev eth0
> #3: echo nameserver 8.8.8.8 >> /etc/resolv.conf
> Where "x.x.x.x/yy" and "z.z.z.z" are the ip address (x.x.x.x), netmassk (yy
> bits) and gateway server (z.z.z.z) that your friend provides.
Thanks for the detailed explanation. I really appreciate it.
What do you think of the following method? (I found it on Google today). Your
feedback would be appreciated.
*****************************************************************************
**How to configure network connection in Linux**
To do so, you need root privileges and _your_favorite_text_editor, as well as
knowledge of which IP address you need to enter.
To find out which network interface need to be configured, type:
dmesg | grep -i Eth
and next strings should appear:
8139too Fast Ethernet driver 0.9.28
eth0: RealTek RTL8139 at 0xdf822c00, 00:15:f2:51:ad:da, IRQ 21
eth0: Identified 8139 chip type 'RTL-8101'
It looks like it is eth0 (because ethernet, 0 - zero device, pretty logical).
Here and below it is assumed that interface is eth0
**Configuring Linux network with static IP**
Just edit the file:
# nano /etc/network/interfaces
or
sudo nano /etc/network/interfaces
For your local network static IPs are surely enough. In particular, for static
IP networking you need to enter: IP-address, netmask and gateway. Change
/etc/network/interfaces to something like this:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.1
In this example, IP-address 192.168.1.5 is set.
**Configuring Linux network with dynamic IP addresses**
Continue to edit network config:
# nano /etc/network/interfaces
or
sudo nano /etc/network/interfaces
It is simpler here:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
Similarly, network interface can be configured via command line:
#dhcpcd eth0
For this, you should install in Debian aptitude install dhcp3-client.
**Configuring DNS nameserver in Linux**
If you don't configure DNS, you cannot connect to any Internet resource by it's
name. But it's very simple to tweak it: just edit or create file
/etc/resolv.conf
# nano /etc/resolv.conf
or
sudo nano /etc/resolv.conf
And type addresses like this:
nameserver 192.168.1.1
nameserver 192.168.2.1
as much as it is need. The word nameserver is required. It is curious, but in
fresh Debian installation there is no resolv.conf...
For changes to take place immediately...
... one can reboot the system, or type:
# /etc/init.d/networking restart
or
sudo /etc/init.d/networking restart
That's all, changes will be applied for all network interfaces.
*********************************************************************************