LinuxQuestions.org
Visit the LQ Articles and Editorials section
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
 
LinkBack Search this Thread
Old 09-25-2010, 08:14 AM   #1
shadyabhi
LQ Newbie
 
Registered: Sep 2008
Posts: 18

Rep: Reputation: 0
More than one MAC addresses on single NIC


My machine has ONE ethernet card and is on a LAN.

IP address is assigned to hosts using DHCP.

I can have more than one MAC address on LAN by running Virtual Machine and setting network to bridged. This way, my virtual machine simply acts like there is one more machine in the network.

Running VMWare for this job is a a bit heavy on resources. Is there a way so that I can I can have 2 or more ip addresses with different MAC address on the same machine without having to run VirtualBox.

By googling, I think its related to bridging and tap. And, I am sure that its NOT IP-ALIASING because in ip-aliasing both the ip addresses have the same MAC address.

Basically, I want my system to have interfaces like:-
  • eth0 - which was originally present
  • lo - thats always present :|
  • newint0 - New interface with new MAC address and IP addresses which can access my LAN directly. Its like if I bind, let us suppose curl to this interface, its like a different connection
  • newint1 - . . . . .
 
Old 09-25-2010, 10:37 AM   #2
Nemesiz
LQ Newbie
 
Registered: Oct 2007
Posts: 22

Rep: Reputation: 1
You can use http://www.primianotucci.com/default.php?view=57
If you will try to redirect some of the ports with iptables it may not work (at least i can not figure out why)
 
Old 09-25-2010, 11:26 PM   #3
jefro
Guru
 
Registered: Mar 2008
Posts: 5,946

Rep: Reputation: 583Reputation: 583Reputation: 583Reputation: 583Reputation: 583Reputation: 583
Wonder if multiple ip addresses would suite your needs?

Last edited by jefro; 09-25-2010 at 11:28 PM.
 
Old 09-26-2010, 01:07 AM   #4
shadyabhi
LQ Newbie
 
Registered: Sep 2008
Posts: 18

Original Poster
Rep: Reputation: 0
./multimac is not working...

Quote:
Originally Posted by Nemesiz View Post
You can use http://www.primianotucci.com/default.php?view=57
If you will try to redirect some of the ports with iptables it may not work (at least i can not figure out why)
Code:
[root@ArchLinux multimac]# pwd
/media/misc1/Downloads/multimac
[root@ArchLinux multimac]# ./multimac 5
Allocating 5 taps... 
5 of 5
.:: Gone into daemonland ::.
[root@ArchLinux multimac]# Starting Master Thread... OK
Starting Interface Threads... 
5 of 5
[root@ArchLinux multimac]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1C:C0:37:5E:25  
          inet addr:10.100.98.112  Bcast:10.100.98.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4888 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2998 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4759932 (4.5 Mb)  TX bytes:218334 (213.2 Kb)
          Interrupt:20 Memory:e0380000-e03a0000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:600 (600.0 b)  TX bytes:600 (600.0 b)

[root@ArchLinux multimac]# modprobe bridge
[root@ArchLinux multimac]# modprobe tun
[root@ArchLinux multimac]# brctl addbr br0
[root@ArchLinux multimac]# brctl addif br0 eth0
[root@ArchLinux multimac]# brctl addif br0 tap0
[root@ArchLinux multimac]# ifconfig eth0 down
[root@ArchLinux multimac]# ifconfig eth0 0.0.0.0 up
[root@ArchLinux multimac]# ifconfig tap0 0.0.0.0 up
[root@ArchLinux multimac]# ifconfig br0 10.100.98.112 netmask 255.255.255.0 up
[root@ArchLinux multimac]# ifconfig tap1 hw ether 00:1C:C0:37:5E:26
[root@ArchLinux multimac]# ifconfig
br0       Link encap:Ethernet  HWaddr 00:1C:C0:37:5E:25  
          inet addr:10.100.98.112  Bcast:10.100.98.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:229 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:32644 (31.8 Kb)  TX bytes:5011 (4.8 Kb)

eth0      Link encap:Ethernet  HWaddr 00:1C:C0:37:5E:25  
          inet addr:10.100.98.112  Bcast:10.100.98.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8177 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3187 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5036971 (4.8 Mb)  TX bytes:238726 (233.1 Kb)
          Interrupt:20 Memory:e0380000-e03a0000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:68 errors:0 dropped:0 overruns:0 frame:0
          TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:5174 (5.0 Kb)  TX bytes:5174 (5.0 Kb)

tap0      Link encap:Ethernet  HWaddr FE:D9:89:FC:6D:C9  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:216 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 b)  TX bytes:35130 (34.3 Kb)

[root@ArchLinux multimac]# ifconfig tap1 10.100.98.252 netmask 255.255.255.0 up
[root@ArchLinux multimac]# ifconfig
br0       Link encap:Ethernet  HWaddr 00:1C:C0:37:5E:25  
          inet addr:10.100.98.112  Bcast:10.100.98.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:475 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:73853 (72.1 Kb)  TX bytes:5089 (4.9 Kb)

eth0      Link encap:Ethernet  HWaddr 00:1C:C0:37:5E:25  
          inet addr:10.100.98.112  Bcast:10.100.98.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8463 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3227 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5103969 (4.8 Mb)  TX bytes:245013 (239.2 Kb)
          Interrupt:20 Memory:e0380000-e03a0000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:88 errors:0 dropped:0 overruns:0 frame:0
          TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:6980 (6.8 Kb)  TX bytes:6980 (6.8 Kb)

tap0      Link encap:Ethernet  HWaddr FE:D9:89:FC:6D:C9  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:425 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:4871 (4.7 Kb)  TX bytes:73437 (71.7 Kb)

tap1      Link encap:Ethernet  HWaddr 00:1C:C0:37:5E:26  
          inet addr:10.100.98.252  Bcast:10.100.98.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:425 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:73437 (71.7 Kb)  TX bytes:4871 (4.7 Kb)

[root@ArchLinux multimac]# ping 10.100.98.4
PING 10.100.98.4 (10.100.98.4) 56(84) bytes of data.
64 bytes from 10.100.98.4: icmp_seq=1 ttl=255 time=0.710 ms
64 bytes from 10.100.98.4: icmp_seq=2 ttl=255 time=0.722 ms
64 bytes from 10.100.98.4: icmp_seq=3 ttl=255 time=1.51 ms
^C
--- 10.100.98.4 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.710/0.983/1.518/0.378 ms
[root@ArchLinux multimac]#
10.100.98.4 is the ip address of my gateway. But, I am not able to surf internet after this.. What is going wrong?
 
Old 09-26-2010, 05:20 AM   #5
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 694

Rep: Reputation: 92
What is the output of "route -n"? That will show all the current
routes. My guess is that the default route went away when you ran
"ifconfig eth0 down" and it wasn't restored after "ifconfig eth0 up".
 
Old 09-27-2010, 02:32 AM   #6
Nemesiz
LQ Newbie
 
Registered: Oct 2007
Posts: 22

Rep: Reputation: 1
Use tap1...tapx as "eth" network devices.

ifconfig eth0 0.0.0.0
ifconfig br0 0.0.0.0

ifconfig tap1 IP1 netmask MASK
ifconfig tap2 IP2 netmask MASK
ip r add default via GATEWAY_IP dev tap1

If you have a problem with 2 or more IP from the same range of IP try to look more info here or in google

Code:
root@nmz:~# ifconfig 
eth0      Link encap:Ethernet  HWaddr XXX
          inet6 addr: XXX/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:257840 errors:0 dropped:0 overruns:0 frame:0
          TX packets:207634 errors:0 dropped:0 overruns:0 carrier:1
          collisions:0 txqueuelen:1000 
          RX bytes:332839363 (317.4 MiB)  TX bytes:26177206 (24.9 MiB)

inet0     Link encap:Ethernet  HWaddr XXX  
          inet6 addr: XXX/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:827 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:224659 (219.3 KiB)  TX bytes:3191 (3.1 KiB)

tap0      Link encap:Ethernet  HWaddr 42:f2:e1:fc:c2:2a  
          inet6 addr: fe80::40f2:e1ff:fefc:c22a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:207594 errors:0 dropped:0 overruns:0 frame:0
          TX packets:257878 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:26079800 (24.8 MiB)  TX bytes:332828057 (317.4 MiB)

tap1      Link encap:Ethernet  HWaddr 3a:4f:ba:7c:c7:6e  
          inet addr:192.168.0.3  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::384f:baff:fe7c:c76e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:257878 errors:0 dropped:0 overruns:0 frame:0
          TX packets:207594 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:332828057 (317.4 MiB)  TX bytes:26079800 (24.8 MiB)
Code:
root@nmz:~# ip r
192.168.0.0/24 dev tap1  proto kernel  scope link  src 192.168.0.3 
default via 192.168.0.1 dev tap1

Last edited by Nemesiz; 09-27-2010 at 02:36 AM.
 
  


Reply

Tags
bridged, ethernet, networking, nic, tap


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding 2 NICs (MAC addresses) to 2 IP Addresses in same Subnet RedHat EL4.0 skhira Linux - Networking 13 02-24-2008 08:16 PM
Binding 2 NICs (MAC addresses) to 2 IP Addresses in same Subnet RedHat EL4.0 skhira Linux - Networking 1 02-09-2008 07:17 AM
setting muliple IP addresses on Single NIC cranium2004 Linux - Networking 1 02-08-2005 05:55 AM
Bind Multi IP addresses to a single NIC sitg Linux - Networking 2 04-30-2004 08:59 PM
Multiple addresses for a single NIC grub Programming 1 08-04-2003 02:24 AM


All times are GMT -5. The time now is 05:43 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration