You are not logged in.

#1 2010-03-10 17:52:27

Celos
Member
Registered: 2007-10-04
Posts: 14

Netcfg and 2 profiles up

Hi,

I'm trying to use netcfg with 2 profiles at the same time. Here are my 2 profiles:
wlan0:
IP: 192.168.1.2
Netmask: 255.255.255.0
Gateway: 192.168.1.1
This is the card i'm using to connect to the net.

eth0:
IP: 192.168.2.2
Netmask: 255.255.255.0
I'm using this card to communicate directly with another system.

When the 2 profiles are UP at the same time, I can't access to internet. It seems that my system doesn't know that it have to use the wlan0 profile.

How can i make netcfg (or something else) use wlan0 profile to access the net, when wlan0 and eth0 profiles are up ?

Thanks

Offline

#2 2010-03-10 18:08:12

NeoXP
Member
From: MS Matrix
Registered: 2009-01-09
Posts: 206
Website

Re: Netcfg and 2 profiles up

Why would you want 2 profiles up anyway, seems to me that this is asking for trouble.

Edit: nevermind first read the fipo thoroughly NeoXP.

Anyhow, I can imagine that your system is confused. After all it is working on two different IP-ranges. Have you made/tried any other solutions than mentioned? And do you have a gateway defined for eth0?

Last edited by NeoXP (2010-03-10 18:14:21)


Arch x86_64 on HP 6820s and on HP nx9420. Registered Linux User 350155, since 24-03-2004
"Everyone said that it could not be done, until someone came along who didn't know that."

Offline

#3 2010-03-10 18:35:27

Celos
Member
Registered: 2007-10-04
Posts: 14

Re: Netcfg and 2 profiles up

I don't have this problem with networkmanager. It can manage my 2 configs.

But i want to use netcfg.

Why do I use 2 profiles ? Because my laptop is connected wireless to a router, and with rj45 to another computer (which is not connected to the router).

Offline

#4 2010-03-11 09:21:53

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Netcfg and 2 profiles up

Celos,

you have a routing problem, usual when one connects to more then one network.

You can check with 'netstat -r'.

You can always force the routing with:

route add default gw 192.168.1.1

This can be done with netcfg but I don't remember exactly how and I am not at home to check,
but you should have a file  '/etc/network.d/examples/ethernet-iproute' which has an example.

Hope that helps.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#5 2010-03-11 17:34:29

Celos
Member
Registered: 2007-10-04
Posts: 14

Re: Netcfg and 2 profiles up

Here is what i get with netstat -r:

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     *               255.255.255.0   U         0 0          0 eth0
192.168.1.0     *               255.255.255.0   U         0 0          0 wlan0
default         192.168.2.1     0.0.0.0         UG        0 0          0 eth0
default         wrt54gs         0.0.0.0         UG        0 0          0 wlan0

even with sudo route add default gw 192.168.1.1, i can't access to internet with my 2 profiles up.

Offline

#6 2010-03-11 17:46:57

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: Netcfg and 2 profiles up

Try route del default gw 192.168.2.1 first.

Offline

#7 2010-03-11 18:04:31

Celos
Member
Registered: 2007-10-04
Posts: 14

Re: Netcfg and 2 profiles up

netstat -r

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     *               255.255.255.0   U         0 0          0 eth0
192.168.1.0     *               255.255.255.0   U         0 0          0 wlan0
default         192.168.2.1     0.0.0.0         UG        0 0          0 eth0
default         wrt54gs         0.0.0.0         UG        0 0          0 wlan0

sudo route del default gw 192.168.2.1

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     *               255.255.255.0   U         0 0          0 eth0
192.168.1.0     *               255.255.255.0   U         0 0          0 wlan0
default         wrt54gs         0.0.0.0         UG        0 0          0 wlan0

sudo route add default gw 192.168.1.1

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     *               255.255.255.0   U         0 0          0 eth0
192.168.1.0     *               255.255.255.0   U         0 0          0 wlan0
default         wrt54gs         0.0.0.0         UG        0 0          0 wlan0
default         wrt54gs         0.0.0.0         UG        0 0          0 wlan0

Still doesn't work. (BTW: wrt54gs=> 192.168.1.1)

It seems I can't specify the route for eth0

Last edited by Celos (2010-03-11 18:05:43)

Offline

#8 2010-03-11 18:22:00

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Netcfg and 2 profiles up

Celos,

your second example seems OK,


Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     *               255.255.255.0   U         0 0          0 eth0
192.168.1.0     *               255.255.255.0   U         0 0          0 wlan0
default         wrt54gs         0.0.0.0         UG        0 0          0 wlan0

so it seems that you don't need to execute 'sudo route add default gw 192.168.1.1', since this only duplicates the entry.

However I can't see why this would bring trouble. Nevertheless try it without the duplicate entry.

Also try 'ping 209.85.227.104'. This is the IP of a Google server, and by doing this we can test if there are any problems
with the DNS translation.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#9 2010-03-11 18:38:47

Celos
Member
Registered: 2007-10-04
Posts: 14

Re: Netcfg and 2 profiles up

Here is the ping:

PING 209.85.227.104 (209.85.227.104) 56(84) bytes of data.
From 192.168.2.1 icmp_seq=1 Destination Host Unreachable
From 192.168.2.1 icmp_seq=2 Destination Host Unreachable

192.168.2.1 is the eth0 IP.

And to be able to ping, the From should be 192.168.1.101 my wlan0 IP.

Offline

#10 2010-03-11 18:48:09

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Netcfg and 2 profiles up

Celos,

can you please post the output of 'netstat -rn' ?

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#11 2010-03-11 18:50:23

Celos
Member
Registered: 2007-10-04
Posts: 14

Re: Netcfg and 2 profiles up

Here it is, netstat -rn

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0
0.0.0.0         192.168.2.1     0.0.0.0         UG        0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlan0

Last edited by Celos (2010-03-11 18:50:41)

Offline

#12 2010-03-11 18:55:00

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Netcfg and 2 profiles up

Celos,

as long as you have the entry


0.0.0.0         192.168.2.1     0.0.0.0         UG        0 0          0 eth0

it will always try to go through eth0, which in your case its wrong.

Try to delete that route:

sudo route del default gw 192.168.2.1

and check that it gets deleted.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#13 2010-03-11 19:22:45

Celos
Member
Registered: 2007-10-04
Posts: 14

Re: Netcfg and 2 profiles up

sudo route del default gw 192.168.2.1
netstat -rn

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlan0

Now I can ping 209.85.227.104, but not google.com. So it seems there is a DNS problem now (how can it be fix ?).

Furthermore, the gw 192.168.2.1 is set always when the eth0 profile is loaded.

Offline

#14 2010-03-11 19:44:53

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Netcfg and 2 profiles up

Celos,

it depends on how you are assigning your IPs, either static or through dhcp.

netcfg provides net-profiles that allow many difficult configurations.

Of course you could go the ugly way, putting the deletion of the 192.160.2.1 in /etc/rc.local and your DNS IP, most probably 192.168.1.1 since you have a Cisco, in /etc/resolv.conf.

Net-profles is cleaner, but you should read http://wiki.archlinux.org/index.php/Netcfg#net-profiles.

In /etc/network.d/examples there are some examples, in particular ethernet-iproute that
should give you a starting point.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#15 2010-03-11 19:50:50

Celos
Member
Registered: 2007-10-04
Posts: 14

Re: Netcfg and 2 profiles up

I added in my eth0 profile:
GATEWAY='192.168.1.1'
DNS=('192.168.1.1')

and it works now !

Thanks for your help !

Next step: trying to use netcfgGUI as non root and without runnin as: sudo netcfgGUI

Last edited by Celos (2010-03-11 19:52:03)

Offline

Board footer

Powered by FluxBB