LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-19-2005, 08:51 PM   #1
cjs500
LQ Newbie
 
Registered: Apr 2005
Posts: 12

Rep: Reputation: 0
Question Multiple MAC Adresses to one NIC?


To clear up the questions why: I want to create a linux router and using one NIC to aquire 2 IP's from my ISP. My ISP assigns IP's via DHCP protocol and it costs extra fpr static IP's. The dynamic IP's seem to take a year before they reset so no point in getting static.

Now, I've create other aliases for Eth0 for example Eth0:0 Eth0:1. I've found multiple examples of creating static IP's to an alias but I noticed that all the aliases have the same MAC address. I tried changing the MAC using ifconfig eth0:0 hw ether 0:.... but this changes the MAC for all.

The other I have read was how vmware does it by bridging a virtual device to the physical adapter. Or however it was explained. Maybe there is a way to do this in linux without vmware?

Is there an easier way to do this? I don't think arp proxy is the method I am after. I want to have multiple IP addresses assigned to a single network adapter via external DHCP server (ISP). The only way I can see to do this is to assign 2 MAC's to one adapter.

Thanks!
 
Old 04-19-2005, 09:30 PM   #2
angrybeaver
Member
 
Registered: Aug 2004
Location: .au
Distribution: debian, BSD
Posts: 104

Rep: Reputation: 17
MAC addresses are for layer 2 logical addressing, you won't ever be able to have more than one on a NIC - so put two NIC's in you box and hang them off a swtich, which uplinks to your router etc. Why is your ISP trying to hand out more than one IP over DHCP? Are you sure it's DHCP? If it is, then they're going to have to bind the two IP's they're handing out to the MACs on your equipment, especially if you're using two layer-2 devices on the same link - in which case it can't be dynamic!

Sounds like something is misconfigured at their end, or there's been a miscommunication somewhere, but DHCP isn't what you'd use for this setup.

Have you asked them how their other clients are doing this? Or are you trying to 'hack' a second IP on the sly?

btw: if somebody knows of a network device on which you can alias MAC addresses, I'd be interested to know - may come in handy.

Last edited by angrybeaver; 04-19-2005 at 09:38 PM.
 
Old 04-19-2005, 09:58 PM   #3
cjs500
LQ Newbie
 
Registered: Apr 2005
Posts: 12

Original Poster
Rep: Reputation: 0
I think I may have answered my own question. Still need to play around with it. I have done the following:

eth0 is the external ethernet adapter.

vgconfig add eth0 2

creates a vlan of eth0.2 with the same mac address

typed command:
ifconfig eth0.2 hw ether 0:10:10:10:10:10 (new mac address)

now I have two seperate mac addresses and have setup the ifcfg-eth0 and ifcfg-eth0.2 in the /etc/sysconfig/network-scripts folder. I'll let you all know if it works. LOL.
 
Old 04-19-2005, 10:12 PM   #4
angrybeaver
Member
 
Registered: Aug 2004
Location: .au
Distribution: debian, BSD
Posts: 104

Rep: Reputation: 17
hehehehe. cross fingers
 
Old 04-19-2005, 11:37 PM   #5
cjs500
LQ Newbie
 
Registered: Apr 2005
Posts: 12

Original Poster
Rep: Reputation: 0
I just about have it running but I am stuck with the vconfig utility. I have done the following:

Current Eth0 adapter is set for dynamically assigned IPs.

I have create Eth0.2 vlan

vconfig add eth0 2 (creates the vlan ID from eth0)
vconfig set_flag eth0.2 1 1 (supposed to allow DHCP -- I not sure if it mean DHCP relay)

I've changed the MAC address of eth0.2 to something different than eth0
I've create an ifcfg-eth0 and ifcfg-eth0.2 with the following settings

DEVICE=eth0 (and eth0.2 for ifcfg-eth0.2 script)
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet

Restarting network it will fail on Eth0.2 but work for Eth0. I can use ifconfig eth0.2 <ip_address> and I am able to ping dynamically assigned IP to eth0 and statically assigned <ip_address> on eth0.2. It doesn't seem to aquire an IP dynamically on eth0.2. I also got a message about needing to load 802.1q module. Not sure where to get it. The set_flag option is supposed to allow DHCPd.

??? Has anyone played around with this?
 
Old 04-28-2005, 06:44 AM   #6
visik7
LQ Newbie
 
Registered: Apr 2005
Posts: 2

Rep: Reputation: 0
I'm in the same situation of cjs500 (more or less)
need to use 2 mac address on one interface no possibility to use 2 ethernet and a switch
I've solved this problem with a bad method:
I've create a local vpn with openvpn so 2 interface tap0 and tap1
than bridged tap0 with eth0
and I can assign to tap1 an arbitrary mac address and to br0 another arbitrary mac address
this method sucks me but it's the only one that I got working since I'm not confident with vconfig
bye

P.S. sorry for bad english

Last edited by visik7; 04-28-2005 at 06:46 AM.
 
Old 04-28-2005, 08:51 AM   #7
cjs500
LQ Newbie
 
Registered: Apr 2005
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks visik7, I haven't gotten much further with vconfig so now your given me something else to try.

So far with vconfig I am getting an error about module 8021q not running blah blah. So when I reboot the VLANs are not there. Using lsmod shows the 8021q in the mod list and I can see 8021q.ko in the kernel source but I'm still learning linux. I have no idea where to have that modul autostart and if that is going to keep the vlan settings on reboot.

Thanks!
 
Old 04-28-2005, 04:22 PM   #8
visik7
LQ Newbie
 
Registered: Apr 2005
Posts: 2

Rep: Reputation: 0
it depends on your distro
on debian you can set up all config stuff from /etc/network/interfaces
for the module part vconfig and brctl brings up their modules as soon as needed.
 
Old 04-29-2005, 03:36 AM   #9
DennisJarosch
LQ Newbie
 
Registered: Apr 2005
Distribution: Gentoo
Posts: 1

Rep: Reputation: 0
Hi guys!

cjs500, you might want to check out this link: http://www.candelatech.com/pipermail...er/000123.html

I am also experimenting with vconfig at the moment. I have set up dev eth0.2 with virtual IP and MAC addresses. Pinging the virtual IP address works like a charm. I am trying to force the kernel to reply to arp requests for my eth0.2 device with the virtual MAC address I supplied. Unfortunately, at the moment arp requests for this device are replied with the _physical_ MAC address (for eth0).

If somebody has an idea what to do, please post it!

Thanks,
Dennis
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
reject certain mac-adresses ekkins Linux - Networking 1 06-19-2005 06:14 PM
linux router must grant internet acces based on MAC adresses YNets269 Linux - Networking 6 07-15-2004 05:56 AM
Getting NIC MAC adress thar Linux - Networking 3 06-28-2004 11:38 PM
iptables and multiple IP adresses on intermet. nldev Linux - Networking 3 06-15-2004 11:10 PM
MAC of NIC sts_cat Linux - General 3 04-05-2001 12:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration