MikroTik и маршрутизация

Network configuration wifi ethernet with linux debian howto

Материал перенесён из старой базы знаний ATC-IP и оформлен в едином стиле нового сайта.

Network
configuration, wi-fi, ethernet with linux debian HOWTO
by Rémy Malgouyres
Cette page existe
en Français
Introduction
This page explains how to configure the linux debian system to be
able to conveniently use an ethernet network card and a wi-fi card,
and to swich easily form one mode of connexion to the other,
and from one network to another.
Typically, you have a router at home which handles both wifi and
ethernet,
and you also would like to be able to connect at work.
Prerequisite : the drivers of your wi-fi card must be installed and tou
should obtain
a nonzero acces-point by typing iwconfig.
Contents
1. The file
resolv.conf
2. The file interfaces
2.A. For
wi-fi
2.B. For
ethernet
DHCP
2.C. For
ethernet
static
3. Obtaining the current
configuration of the interfaces
3.A. For
wi-fi
3.B. For
ethernet
4.
Reinitialization
of networking
5.
Shell scripts
for
automatization
5.A. For
wi-fi
5.B. For
ethernet
DHCP
5.C. For
ethernet static
1. The file
resolv.conf
To configure networking under debian, it's simplest to configure
the files /etc/network/interfaces and /etc/resolv.conf
Below appears my file /etc/resolv.conf (for my internet provider
wanadoo.
The IP addresses here are the addresses of the primary and secundary
name server (DNS).)
search
nameserver 193.252.19.3
nameserver 193.252.96.4
2. The file interfaces
2.A. For wi-fi
Here is my file /etc/network/interfaces used for wi-fi.
It is configured as dhcp, that is, the IP address
is not fixed in the debian system, but is obtained from
the router via DHCPREQUEST
I named this file /etc/network/interfaces.wifi
When I want to use wifi, I create a symbolic link
ln -s /etc/network/interfaces.wifi /etc/network/interfaces
# This file describes the network
interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
#the wifi network interface
# my wifi interface is called rausb0,
# I knew that by typing ifconfig and iwconfig (see below)
auto rausb0
iface rausb0 inet dhcp
wireless-essid my_essid
wireless-mode managed
wireless-key AF32852BE7A39B522BG60C4353
# The wep key which appear here is just an example. This is not
# really my web key, which is secret
The ESSID and the WEP key must be correctly configured on the
modem-router.
2.B. For
ethernet
Here is my file /etc/network/interfaces for the ethernet card.
It is configured as dhcp, that is the IP address
isn't fixed in the debian system, but is obtained from
the router via DHCPREQUEST
I called this file /etc/network/interfaces.home
(I also have such a file when I want to connect at work)
When I want to use the ethernet network, I create a symbolic link
ln -s /etc/network/interfaces.home /etc/network/interfaces
Note : The network 192.168.0 corresponds to my NETGEAR router.
You have to change these values according to your router's configuration
# This file describes the network
interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo eth0
iface lo inet loopback
# The primary network interface
# my ethernet interface is called eth0,
# I knew that by typing ifconfig (see below)
iface eth0 inet dhcp
2.C. For
ethernet
static
In my office, we have an ethernet local network that use static IP
addreses.
My network administrator gave me a fixed IP address to use
(for me it is the 192.168.151.102).
(I can also configure my home router to use static addresses
but it doesn't suit well wi-fi networking).
Here is the file /etc/network/interfaces I use for static addressing.
I named it /etc/network/interfaces.work
When I get work and want to use
Позвонить +7 (343) 382-33-16