View previous topic :: View next topic |
Author |
Message |
gentoofly n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 08 Nov 2007 Posts: 11
|
Posted: Thu Dec 27, 2007 10:05 am Post subject: two interfaces questions |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
poly_poly-man Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/2495233444c550ec2e4336.png)
Joined: 06 Dec 2006 Posts: 2477 Location: RIT, NY, US
|
Posted: Thu Dec 27, 2007 2:39 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
gentoofly n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 08 Nov 2007 Posts: 11
|
Posted: Fri Dec 28, 2007 4:41 am Post subject: |
|
|
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? ![Smile :)](images/smiles/icon_smile.gif) _________________ ...sorry for my ugly english, I hope you will understood me correctly... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
desultory Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/15563850365c4d454383627.gif)
Joined: 04 Nov 2005 Posts: 9410
|
Posted: Fri Dec 28, 2007 10:31 am Post subject: |
|
|
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? ![Smile :)](images/smiles/icon_smile.gif) | 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 |
|
![](templates/gentoo/images/spacer.gif) |
gentoofly n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 08 Nov 2007 Posts: 11
|
Posted: Fri Dec 28, 2007 6:27 pm Post subject: |
|
|
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
Sometimes the eth0 starts at boot time, sometime don't... Without any (visible for me) configuration changes... So strange for me
Can anyone explain me about it? pleeeeese ![Smile :)](images/smiles/icon_smile.gif) _________________ ...sorry for my ugly english, I hope you will understood me correctly... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
poly_poly-man Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/2495233444c550ec2e4336.png)
Joined: 06 Dec 2006 Posts: 2477 Location: RIT, NY, US
|
Posted: Fri Dec 28, 2007 7:14 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
xpeed n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/Southpark/avatar45.gif)
Joined: 28 Dec 2007 Posts: 6
|
Posted: Fri Dec 28, 2007 7:51 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
poly_poly-man Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/2495233444c550ec2e4336.png)
Joined: 06 Dec 2006 Posts: 2477 Location: RIT, NY, US
|
Posted: Fri Dec 28, 2007 8:44 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
gentoofly n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 08 Nov 2007 Posts: 11
|
Posted: Sat Dec 29, 2007 3:27 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
gentoofly n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 08 Nov 2007 Posts: 11
|
Posted: Sat Dec 29, 2007 8:36 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
MostAwesomeDude Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 12 Aug 2007 Posts: 373
|
Posted: Sat Dec 29, 2007 10:24 am Post subject: |
|
|
Use sys-apps/netplug instead of ifplugd. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|