WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Multihomed system, static IP and ethx H/W assignment  (Read 4980 times)

Offline itias

  • Newbie
  • *
  • Posts: 17
Multihomed system, static IP and ethx H/W assignment
« 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:

  • need to make sure that given NIC will always be eth0
  • one of the NIC cards should have static IP


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

Offline batnas

  • Full Member
  • ***
  • Posts: 122
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #1 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

Offline batnas

  • Full Member
  • ***
  • Posts: 122
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #2 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

Offline itias

  • Newbie
  • *
  • Posts: 17
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #3 on: June 01, 2010, 04:15:08 AM »
Thanks. Do I need to use nodhcp bootcode?

Greg

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #4 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.

Offline batnas

  • Full Member
  • ***
  • Posts: 122
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #5 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

Offline itias

  • Newbie
  • *
  • Posts: 17
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #6 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

Offline batnas

  • Full Member
  • ***
  • Posts: 122
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #7 on: June 01, 2010, 12:28:57 PM »
What do you mean by NIC??

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #8 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.
The only barriers that can stop you are the ones you create yourself.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #9 on: June 01, 2010, 12:51:24 PM »
What do you mean by NIC??

Network Interface Card
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline althalus

  • Sr. Member
  • ****
  • Posts: 351
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #10 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.

Offline itias

  • Newbie
  • *
  • Posts: 17
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #11 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!

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #12 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.
The only barriers that can stop you are the ones you create yourself.

Offline itias

  • Newbie
  • *
  • Posts: 17
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #13 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

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: Multihomed system, static IP and ethx H/W assignment
« Reply #14 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.
The only barriers that can stop you are the ones you create yourself.