Logo 
Search:

Unix / Linux / Ubuntu Answers

Ask Question   UnAnswered
Home » Forum » Unix / Linux / Ubuntu       RSS Feeds
  on Dec 18 In Unix / Linux / Ubuntu Category.

  
Question Answered By: Adah Miller   on Dec 18

Googling for the error message 'SIOCSIFMETRIC' I found some more
information. First : the metric parameter is not anymore valid with
ifconfig with Linux. The NIC always has the metric 1. This can be
nasty if you have more than 1 NIC. There is a package "ifmetric" that
can change all the routes associated with a specified NIC. The
interfaces and the routes must have been set up before. So if one
want to bring 2 NICs he must bring the first one and change it's
metric with ifmetric. Then, and only then, you can bring another NIC
up and repeat the process if you have more NICs. And don't forget dhcp
for the NIC if you need it too. I'm using wpa_supplicant for the
wireless nic. I have to bring up the wireless nic and then
wpa_supplicant and get an IP with dhclient.

I have a short script that does it when I need it. The first network
(eth0) is already up when I call the script :
--------------------------------------------------------
#!/bin/sh
ifmetric eth0 10
ifconfig eth2 up
iwconfig eth2 ESSID "myhomeessid" channel 1 mode managed ap
ff:ff:ff:ff:ff:ff Nickname "Broadcom BCM4318" rate 54M auto rts off
frag off key restricted s:mysecretpass txpower 19
wpa_supplicant -Dwext -ieth2 -c/etc/wpa_supplicant.conf
dhclient eth2 & sleep 2 && iwconfig eth2 ESSID "dd-wrt"
ifmetric eth2 20
exit
---------------------------------------------------------
The wpa_supplicant.conf contains the necessary info to reach my
private wireless network:
------------------------
network={
ssid="myhomeessid"
key_mgmt=WPA-PSK
psk="mysecretpass"
}
-------------------------

It's a first try and is not sophisticated at all. It allows me to
have the 2 NIC working at the same time or bring one of them I don't
need anymore down.

I hope that this stuff could help anybody with many NIC and/or a
wireless NIC. It's mostly an exercise to learn some network stuff.

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on 2 NICs & howto set metric Or get search suggestion and latest updates.


Tagged: