Configurazione delle interfacce di rete

Discussioni sui sistemi operativi Unix like, con un occhio di riguardo per Linux.

Moderatori: cb_123, thrantir, netvandal, CaberNET54

Configurazione delle interfacce di rete

Messaggiodi balubeto il 21 mag 2007, 10:26

CIAO

Ho queste interfacce di rete:

Codice: Seleziona tutto
PLUTO:~# ifconfig -v eth1
eth1      Link encap:Ethernet  HWaddr 00:02:3F:6D:7D:5C 
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::202:3fff:fe6d:7d5c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2191 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1123 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:203549 (198.7 KiB)  TX bytes:167005 (163.0 KiB)
          Interrupt:193 Base address:0xa000

PLUTO:~# ifconfig -v eth2                                                                                               
eth2      Link encap:Ethernet  HWaddr 00:90:4B:49:F5:3B 
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:6 overruns:0 frame:0
          TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:1764 (1.7 KiB)
          Interrupt:5 Base address:0xc000

PLUTO:~# iwconfig eth2                                                                                                     
eth2      IEEE 802.11b/g  ESSID:off/any  Nickname:"Broadcom 4306"
          Mode:Managed  Frequency=2.484 GHz  Access Point: Invalid   
          Bit Rate=1 Mb/s   
          RTS thr:off   Fragment thr:off
          Encryption key:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


Da quanto avete capito, l'interfaccia eth1 rappresenta la scheda di rete Ethernet; mentre quella eth1 rappresenta il chip di rete Wireless del mio notebook.

Ora, come faccio a configurare l'interfaccia di rete eth2 come eth1 usando ifconfig per i parametri come l'indirizzo IP del computer, quello del gateway, quello di netmask, ................?

Una volta configurato i parametri wireless con il comando iwconfig e provato se tutto funziona correttamente, come faccio ad inserire, in modo agevole, tutti questi parametri nel file /etc/network/interfaces per far in modo che, ad ogni avvio di Linux, abbia tutti i parametri dell'interfacce ethernet e wireless gia` configurati?

GRAZIE

CIAO

Uso la Debian Lenny Testing.
Balubeto

Su Facebook, e` nato il gruppo SoftHard per tutti. Vi aspetto.
balubeto
Cittadino verde
Cittadino verde
 
Messaggi: 66
Iscritto il: 20 apr 2007, 13:02

 

Messaggiodi balubeto il 22 mag 2007, 19:10

Ho deciso di fare tutto a mano anche per imparare bene:

Dato che il mio portatile ha anche un chip wireless 802.11b/g

Codice: Seleziona tutto
PLUTO:~# lspci | grep -i wireless                                                                                           
02:02.0 Network controller: Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller (rev 03)


ho provato a configurare il file /etc/network/interfaces in questo modo:

Codice: Seleziona tutto
PLUTO:~# cat /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 primary network interface
allow-hotplug eth1
iface eth1 inet static
        address 192.168.1.3
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 192.168.1.1


iface eth2 inet static
        address 192.168.1.3
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
        dns-nameservers 192.168.1.1
        wireless-essid Reparto_giorno
        wireless-mode Manager
        wireless-channel 6
        wireless-ap 00:12:A9:55:11:43
        wireless-key 62D20F769AC17D958E31DF5039D088E1

auto eth1


Dove eth1 e` l'interfaccia della scheda di rete cablata; mentre eth2 e` l'interfaccia del chip di rete wireless.

Il valore di wireless-ap e` il MAC del mio AP Client/Repeater (che e` connesso ad un AP "Server" che e` collegato via cavo ad un firewall hardware che funge da gateway) ed il valore di wireless-key e` la chiave WEP a 152 bit generata dal mio AP Client/Repeater.

Dopo aver riavviato Linux, ho dato i seguenti comandi da un terminale:

Codice: Seleziona tutto
PLUTO:~# ifconfig
eth1      Link encap:Ethernet  HWaddr 00:02:3F:6D:7D:5C
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:193 Base address:0xa000

eth2      Link encap:Ethernet  HWaddr 00:90:4B:49:F5:3B
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:1764 (1.7 KiB)
          Interrupt:5

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:58 errors:0 dropped:0 overruns:0 frame:0
          TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4870 (4.7 KiB)  TX bytes:4870 (4.7 KiB)

PLUTO:~# iwconfig
lo        no wireless extensions.

eth1      no wireless extensions.

eth0      no wireless extensions.

eth2      IEEE 802.11b/g  ESSID:off/any  Nickname:"Broadcom 4306"
          Mode:Managed  Frequency=2.484 GHz  Access Point: Invalid
          Bit Rate=1 Mb/s   Tx-Power=15 dBm
          RTS thr:off   Fragment thr:off
          Encryption key:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

sit0      no wireless extensions.


e, fin qui, mi sembra tutto ok.

Ora, ho disattivato eth1 ed attivato eth2 cosi`:

Codice: Seleziona tutto
PLUTO:~# ifdown eth1
PLUTO:~# ifup eth2
PLUTO:~# ifconfig eth2
eth2      Link encap:Ethernet  HWaddr 00:90:4B:49:F5:3B
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::290:4bff:fe49:f53b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1 errors:0 dropped:7 overruns:0 frame:0
          TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:22 (22.0 b)  TX bytes:6536 (6.3 KiB)
          Interrupt:5

PLUTO:~# iwconfig eth2
eth2      IEEE 802.11b/g  ESSID:"Reparto_giorno"  Nickname:"Broadcom 4306"
          Mode:Managed  Frequency=2.437 GHz  Access Point: 00:12:A9:55:11:43
          Bit Rate=11 Mb/s   Tx-Power=15 dBm
          RTS thr:off   Fragment thr:off
          Encryption key:62D2-0F76-9AC1-7D95-8E31-DF50-39   Security mode:open
          Link Quality=100/100  Signal level=3/3  Noise level=188/100
          Rx invalid nwid:0  Rx invalid crypt:7  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


A questo punto, la spia del Wireless incomincia a lampeggiare e vedo, dall'interfaccia WEB del mio AP Client/Repeater, che il portatile e` connesso. Per sicurezza, provo a scrivere:

Codice: Seleziona tutto
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
localnet        *               255.255.255.0   U     0      0        0 eth2
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth2


A questo punto, noto che l'ultima riga stenta ad apparire. Quindi, scrivo:

Codice: Seleziona tutto
PLUTO:~# cat /proc/net/wireless
Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 20
  eth2: 0000  100.    3.  187.       0     73      0      0      0        0
PLUTO:~# tail -n 52 /var/log/messages
May 22 12:52:56 localhost kernel: eth1: link down
May 22 12:52:56 localhost kernel: NET: Registered protocol family 10
May 22 12:52:56 localhost kernel: lo: Disabled Privacy Extensions
May 22 12:52:56 localhost kernel: ADDRCONF(NETDEV_UP): eth1: link is not ready
May 22 12:52:56 localhost kernel: IPv6 over IPv4 tunneling driver
May 22 12:52:57 localhost hpiod: 1.6.10 accepting connections at 2208...
May 22 12:53:00 localhost kernel: ACPI: Battery Slot [BAT1] (battery present)
May 22 12:53:00 localhost kernel: ACPI: AC Adapter [ACAD] (on-line)
May 22 12:53:00 localhost kernel: ACPI: Power Button (FF) [PWRF]
May 22 12:53:00 localhost kernel: ACPI: Lid Switch [LID]
May 22 12:53:00 localhost kernel: ACPI: Power Button (CM) [PWRB]
May 22 12:53:01 localhost kernel: lp0: using parport0 (interrupt-driven).
May 22 12:53:01 localhost kernel: ppdev: user-space parallel port driver
May 22 12:53:06 localhost dhcdbd: Started up.
May 22 12:53:06 localhost kernel: bcm43xx: PHY connected
May 22 12:53:06 localhost kernel: bcm43xx: Microcode rev 0x127, pl 0xe (2005-04-18  02:36:27)
May 22 12:53:06 localhost kernel: bcm43xx: Radio turned on
May 22 12:53:07 localhost kernel: bcm43xx: Chip initialized
May 22 12:53:07 localhost kernel: bcm43xx: 32-bit DMA initialized
May 22 12:53:07 localhost kernel: bcm43xx: Keys cleared
May 22 12:53:07 localhost kernel: bcm43xx: Selected 802.11 core (phytype 2)
May 22 12:53:07 localhost kernel: ADDRCONF(NETDEV_UP): eth2: link is not ready
May 22 12:53:41 localhost kernel: [drm] Initialized drm 1.0.1 20051102
May 22 12:53:41 localhost kernel: ACPI: PCI Interrupt 0000:01:05.0[A] -> GSI 16 (level, low) -> IRQ 185
May 22 12:53:41 localhost kernel: [drm] Initialized radeon 1.25.0 20060524 on minor 0
May 22 12:53:42 localhost kernel: Bluetooth: Core ver 2.10
May 22 12:53:42 localhost kernel: NET: Registered protocol family 31
May 22 12:53:42 localhost kernel: Bluetooth: HCI device and connection manager initialized
May 22 12:53:42 localhost kernel: Bluetooth: HCI socket layer initialized
May 22 12:53:42 localhost kernel: Bluetooth: L2CAP ver 2.8
May 22 12:53:42 localhost kernel: Bluetooth: L2CAP socket layer initialized
May 22 12:53:42 localhost kernel: Bluetooth: RFCOMM socket layer initialized
May 22 12:53:42 localhost kernel: Bluetooth: RFCOMM TTY layer initialized
May 22 12:53:42 localhost kernel: Bluetooth: RFCOMM ver 1.8
May 22 12:53:43 localhost kernel: mtrr: 0xf0000000,0x8000000 overlaps existing 0xf0000000,0x4000000
May 22 12:53:43 localhost last message repeated 2 times
May 22 12:53:43 localhost kernel: agpgart: Found an AGP 3.0 compliant device at 0000:00:00.0.
May 22 12:53:43 localhost kernel: agpgart: Putting AGP V3 device at 0000:00:00.0 into 4x mode
May 22 12:53:43 localhost kernel: agpgart: Putting AGP V3 device at 0000:01:05.0 into 4x mode
May 22 12:53:43 localhost kernel: [drm] Setting GART location based on new memory map
May 22 12:53:43 localhost kernel: [drm] Loading R200 Microcode
May 22 12:53:43 localhost kernel: [drm] writeback test succeeded in 1 usecs
May 22 12:54:17 localhost gconfd (root-3232): inizializzazione (versione 2.16.1), pid 3232, utente "root"
May 22 12:54:17 localhost gconfd (root-3232): L'indirizzo "xml:readonly:/etc/gconf/gconf.xml.mandatory" è stato risolta ad una sorgente di configurazione in sola lettura in posizione 0
May 22 12:54:17 localhost gconfd (root-3232): L'indirizzo "xml:readwrite:/root/.gconf" è stato risolto ad una sorgente di configurazione scrivibile in posizione 1
May 22 12:54:17 localhost gconfd (root-3232): L'indirizzo "xml:readonly:/etc/gconf/gconf.xml.defaults" è stato risolta ad una sorgente di configurazione in sola lettura in posizione 2
May 22 12:54:17 localhost gconfd (root-3232): L'indirizzo "xml:readonly:/var/lib/gconf/debian.defaults" è stato risolta ad una sorgente di configurazione in sola lettura in posizione 3
May 22 12:54:17 localhost gconfd (root-3232): L'indirizzo "xml:readonly:/var/lib/gconf/defaults" è stato risolta ad una sorgente di configurazione in sola lettura in posizione 4
May 22 12:54:23 localhost gconfd (root-3232): L'indirizzo "xml:readwrite:/root/.gconf" è stato risolto ad una sorgente di configurazione scrivibile in posizione 0
May 22 12:57:45 localhost kernel: bcm43xx: set security called, .active_key = 0, .level = 1, .enabled = 1, .encrypt = 1
May 22 12:57:45 localhost kernel: SoftMAC: Open Authentication completed with 00:12:a9:55:11:43
May 22 12:57:45 localhost kernel: ADDRCONF(NETDEV_CHANGE): eth2: link becomes ready


e noto che la linea wireless e` disturbata (parametro noise). Infatti, pingando il gateway (192.168.1.1), mi indica che e` irraggiugbile (dimenticavo di dirvi che la spia Wireless del notebook rimane quasi sempre spenta anche se l'AP mi indica che il notebook e` connesso).

Che cosa c'e` che non va?

GRAZIE

CIAO
Balubeto

Su Facebook, e` nato il gruppo SoftHard per tutti. Vi aspetto.
balubeto
Cittadino verde
Cittadino verde
 
Messaggi: 66
Iscritto il: 20 apr 2007, 13:02


Torna a Linux e Unix

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite