Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: itias on June 01, 2010, 02:28:05 AM

Title: Multihomed system, static IP and ethx H/W assignment
Post by: itias on June 01, 2010, 02:28:05 AM
Hello,

I'm going to set up a new firewall/router based on TC, internet connection will be PPPoE based.
There are two things I've never tried with TC so I'm looking for some help:



So I guess the first one can be achieved with udev and the other one by nodhcp boot code? Would that be correct? Has anyone tried any of the above things and can give me some more hints?

Thanks

Greg
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: batnas on June 01, 2010, 03:05:38 AM
  • one of the NIC cards should have static IP



This one you can achieve in /etc/resolv
I'll tell you how in a minute

\\Batnas
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: batnas on June 01, 2010, 03:10:23 AM
This from my bootlocal.sh:
Code: [Select]
ifconfig eth0 10.0.1.80 netmask 255.255.255.0 broadcast 10.0.1.255 up
route add default gw 10.0.1.10
echo nameserver 10.0.1.10 > /etc/resolv.conf

Some of it you might put in a backup...

\\Batnas
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: itias on June 01, 2010, 04:15:08 AM
Thanks. Do I need to use nodhcp bootcode?

Greg
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: danielibarnes on June 01, 2010, 08:29:24 AM
Quote
Do I need to use nodhcp bootcode?
Yes, then you call /etc/init.d/dhcp.sh from /opt/bootlocal.sh after you configure the static interface.
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: batnas on June 01, 2010, 08:47:06 AM
Yes, then you call /etc/init.d/dhcp.sh from /opt/bootlocal.sh after you configure the static interface.

I don't. I do have the nodhcp bootcode (sorry, i forgot), but do not call /etc/init.d/dhcp.sh....

\\atnas
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: itias on June 01, 2010, 12:24:24 PM
Great, thanks! Looks like my static IP question is answered:)
How about my other question:

Code: [Select]
need to make sure that given NIC will always be eth0
Could anyone help me in that regard?

Greg
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: batnas on June 01, 2010, 12:28:57 PM
What do you mean by NIC??
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: curaga on June 01, 2010, 12:40:08 PM
You'll need to write an udev rule for that. Google for "writing udev rules"; the Linux From Scratch book's device handling part might also be helpful.
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: bmarkus on June 01, 2010, 12:51:24 PM
What do you mean by NIC??

Network Interface Card
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: althalus on June 01, 2010, 05:13:07 PM
Yes, then you call /etc/init.d/dhcp.sh from /opt/bootlocal.sh after you configure the static interface.

I don't. I do have the nodhcp bootcode (sorry, i forgot), but do not call /etc/init.d/dhcp.sh....

\\atnas
You overlook that he has (at least) 2 NICs, and only wants one to be static. That is why he needs to start dhcp after configuring the static interface and you do not.
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: itias on June 02, 2010, 04:31:03 AM
I have created a new file /etc/udev/rules.d/10-netinterfaces.rules

containing the following lines:
Code: [Select]
KERNEL=="eth*", ATTR{address}=="00:22:15:10:be:b4", NAME="eth2"
KERNEL=="eth*", ATTR{address}=="e0:cb:4e:b9:50:25", NAME="eth3"

added that file to backup and after reboot I still have my good old eth0 and eth1 :(
Any hints please? Thanks!
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: curaga on June 02, 2010, 04:34:21 AM
Udev runs much earlier than backup, so you should either do a remaster or store that file in an additional initramfs.
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: itias on June 02, 2010, 05:33:32 AM
So you mean creating a new myramfile.gz file containing just my 10-netinterfaces.rules file, putting it in /boot folder and adding the following line to menu.lst?

Code: [Select]
initramfs /boot/myramfile.gz
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: curaga on June 02, 2010, 06:24:02 AM
Actually, that method only works on the syslinux family of bootloaders. TC does have generic loading of those as well, but it happens at the extension stage, too late for your purposes.

On grub a remaster it is.
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: althalus on June 02, 2010, 02:30:12 PM
Actually, that method only works on the syslinux family of bootloaders. TC does have generic loading of those as well, but it happens at the extension stage, too late for your purposes.

On grub a remaster it is.

Getting slightly off topic, but what's to stop TC from finding and loading the extra *.gz files for TC BEFORE starting up udevd? That would make a bit more sense and make the extra *.gz files a little more useful IMO.
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: curaga on June 02, 2010, 02:43:50 PM
Some technical obstacles (if they reside on unknown devices), but it's a slippery slope there. I think soon entry points would be wanted for every step of the boot process, bringing unnecessary complexity.
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: althalus on June 02, 2010, 02:58:07 PM
Some technical obstacles (if they reside on unknown devices), but it's a slippery slope there. I think soon entry points would be wanted for every step of the boot process, bringing unnecessary complexity.
Hmm, ok, point taken.
Title: Re: Multihomed system, static IP and ethx H/W assignment
Post by: itias on June 04, 2010, 01:24:28 AM
Thank you all for helping me out:)
I'm not quite happy with having to remaster but it is what it is:)

Thanks

Greg