Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
two interfaces questions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
gentoofly
n00b
n00b


Joined: 08 Nov 2007
Posts: 11

PostPosted: Thu Dec 27, 2007 10:05 am    Post subject: two interfaces questions Reply with quote

Hi!

I have a laptop(lenovo t60) and two adapters:
eth0 is wired (ethernet)
eht1 is wireless (wifi)

The both interfaces is configured successfully, so I can start/stop them via the /etc/init.d/net.eth* scripts.

Question N1.
My primary network is wireless, so I add the net.eth1 into my default runlevel and remove net.eth0 from it.
But the net.eth0 starts before netmount :( Where can I setup eth1 as my primary(default) interface? In other words, any network services like netmount must needs not eth0 but eth1.
Currently, becouse the both interfaces connected to same network(have same defaultroute), I need to stop eth0, and restart netmount after start manually.

Question N2.
When I connect eth0, I stop eth1 and start eth0. How about automation? I have tried ifplugd, but it is not for me... or I don't understood it :)
How can I set some priorities for the interfaces? In my case, eth0 have higher priority, but when it is not connected, eth1 must be active and primary...

Thnx.
_________________
...sorry for my ugly english, I hope you will understood me correctly...


Last edited by gentoofly on Fri Dec 28, 2007 6:02 pm; edited 1 time in total
Back to top
View user's profile Send private message
poly_poly-man
Advocate
Advocate


Joined: 06 Dec 2006
Posts: 2477
Location: RIT, NY, US

PostPosted: Thu Dec 27, 2007 2:39 pm    Post subject: Reply with quote

Why not switch the devices? I had a problem for a while that eth0 is required, but for a time, my only network device was eth1 (eth0 was lost to firewire ethernet driver). Use udev to switch the device names (look in /etc/udev.d), then switch the config files also.

As for automating the network switches, AFAIK, there's no way to "just let it happen", but you could put together a quick bash script to change the networks.

poly-p man
_________________
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see topic 838248. Potentially still a WiP.
Back to top
View user's profile Send private message
gentoofly
n00b
n00b


Joined: 08 Nov 2007
Posts: 11

PostPosted: Fri Dec 28, 2007 4:41 am    Post subject: Reply with quote

poly_poly-man wrote:
Use udev to switch the device names (look in /etc/udev.d), then switch the config files also.


Unfortunately I have no /etc/udev.d, but there is /etc/udev/rules.d - is it ok or my system is wrong? I found here /etc/udev/rules.d/90-network.rules which consist:
Quote:

SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start"
SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop"


Where is the net.sh script and what means the %k parameter?
Am I on the right way at all? :)
_________________
...sorry for my ugly english, I hope you will understood me correctly...
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Fri Dec 28, 2007 10:31 am    Post subject: Reply with quote

gentoofly wrote:
Unfortunately I have no /etc/udev.d, but there is /etc/udev/rules.d - is it ok or my system is wrong?
That is as expected.
gentoofly wrote:
Where is the net.sh script and what means the %k parameter?
Respectively, /lib/udev/net.sh and the name of the device node as determined by the kernel itself.
gentoofly wrote:
Am I on the right way at all? :)
Given what you have described, for the first issue I consider setting RC_NET_STRICT_CHECKING in /etc/conf.d/rc to no, and for the second I would consider using simple shell scripts.
Back to top
View user's profile Send private message
gentoofly
n00b
n00b


Joined: 08 Nov 2007
Posts: 11

PostPosted: Fri Dec 28, 2007 6:27 pm    Post subject: Reply with quote

desultory wrote:
for the first issue I consider setting RC_NET_STRICT_CHECKING in /etc/conf.d/rc to no

Already 'no'(by default, don't touch this file at all).
But the eth0 is starts anyway :(

There is one more strange thing. As I described before, my primary goal is to disable the eth0. I removed the eth0 from the default runlevel but it don't help(the eth0 starts for the netmount). It is strange... But overmore, the eth0 starts not every time! It starts in most cases, but not always! Some times it don't starts and all things work as I want: the eth0 down, the eth1 up, the netmount up...

I can understand that the eth0 required by some services like netmount. I can understand that this link can not simple moved to eth1.
But I can NOT understand, why these things is so undeterminated :o
Sometimes the eth0 starts at boot time, sometime don't... Without any (visible for me) configuration changes... So strange for me :o

Can anyone explain me about it? pleeeeese :)
_________________
...sorry for my ugly english, I hope you will understood me correctly...
Back to top
View user's profile Send private message
poly_poly-man
Advocate
Advocate


Joined: 06 Dec 2006
Posts: 2477
Location: RIT, NY, US

PostPosted: Fri Dec 28, 2007 7:14 pm    Post subject: Reply with quote

Possible solution:

Make the setting for eth0 (in your conf.d/net file)
Code:
config_eth0=( "null" )
. Leave eth1 as it is. This will automatically do nothing for eth0 and set up eth1 on boot, while letting all else work properly.

When you want to use eth0, you would have to give the commands manually, i.e. dhcpcd eth0 for dhcp.

poly-p man
_________________
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see topic 838248. Potentially still a WiP.
Back to top
View user's profile Send private message
xpeed
n00b
n00b


Joined: 28 Dec 2007
Posts: 6

PostPosted: Fri Dec 28, 2007 7:51 pm    Post subject: Reply with quote

why you don't just dissable your net autoconfig made by udev (inits scripts net.eth0 eth etc) and make your owns? like:

Code:

#!/sbin/runscript

start()
{
   einfo "eth1 up "
   ifconfig lo up
   ifconfig eth1 [ip addr] netmask 255.255.255.0 up
   route add default netmask 0 gw [gateway] eth1
   .....
   bla bla bla
}

stop()
{
   einfo "eth1 down"
   ifconfig eth1 0 down
}


save as /etc/init.d/inet-script and:

Code:
# update-rc add inet-script default


un saludo.
_________________
unz unz
Back to top
View user's profile Send private message
poly_poly-man
Advocate
Advocate


Joined: 06 Dec 2006
Posts: 2477
Location: RIT, NY, US

PostPosted: Fri Dec 28, 2007 8:44 pm    Post subject: Reply with quote

xpeed wrote:
why you don't just dissable your net autoconfig made by udev (inits scripts net.eth0 eth etc) and make your owns? like:

Code:

#!/sbin/runscript

start()
{
   einfo "eth1 up "
   ifconfig lo up
   ifconfig eth1 [ip addr] netmask 255.255.255.0 up
   route add default netmask 0 gw [gateway] eth1
   .....
   bla bla bla
}

stop()
{
   einfo "eth1 down"
   ifconfig eth1 0 down
}


save as /etc/init.d/inet-script and:

Code:
# update-rc add inet-script default


un saludo.


...or just make all of the network scripts rely on net.eth1 raqther than net.eth0......

You'd have to change that anyway following xspeed's scripts...

poly-p man
_________________
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see topic 838248. Potentially still a WiP.
Back to top
View user's profile Send private message
gentoofly
n00b
n00b


Joined: 08 Nov 2007
Posts: 11

PostPosted: Sat Dec 29, 2007 3:27 am    Post subject: Reply with quote

Quote:

...or just make all of the network scripts rely on net.eth1 raqther than net.eth0......


this is the what I really want to do... but how?

I have read some docs and now I know that any service can have NEED and USE flags which describes what it need for start and what it can use.
For example, the netmount service NEED a net service. The net service is not real service but virtual, the service which is provided by one or more real services. The net.eth1 provide the virtual net service alike the net.eth0. So there is no reasons to start the net.eth0 instead of the net.eth1.
_________________
...sorry for my ugly english, I hope you will understood me correctly...
Back to top
View user's profile Send private message
gentoofly
n00b
n00b


Joined: 08 Nov 2007
Posts: 11

PostPosted: Sat Dec 29, 2007 8:36 am    Post subject: Reply with quote

One more step to solve the problem :)
I did some tests and noticed that the net.eth0 starts only for the first system boot. After any reboots of the system, the net.eth0 don't starts.
However there is one strange thing :) Yes, all work as I want. There is no any output of the /etc/init.d/net.eth1 at the boot time. Overmore, netmount and sshd don't starts saying they scheduled to the net.eth1 start :) However all work fine :) The net.eth1 is up. The network shares is mounted. The SSH daemon is running.
_________________
...sorry for my ugly english, I hope you will understood me correctly...
Back to top
View user's profile Send private message
MostAwesomeDude
Guru
Guru


Joined: 12 Aug 2007
Posts: 373

PostPosted: Sat Dec 29, 2007 10:24 am    Post subject: Reply with quote

Use sys-apps/netplug instead of ifplugd.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum