Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to make some virtual MAC addresses for my network adapter or wireless adapter, so I can connect to network with more than one IP address from one computer or laptop.

How can I do it? (I know it's possible ,because one of my friends done it in university and have more than one - sometimes up to 255 - IP addresses on a network).

share|improve this question
you have to specify which operative system are you using and, eventually, which distribution. – andcoz Oct 1 '11 at 21:15

2 Answers

You do not need more that one mac address to have multiple ip addresses on a single network interface. This technique is called ip aliasing.

Each operative system has a slightly different syntax but usually, to set different ip addresses on the same interface, you need only to do something like:

ifconfig eth0 192.168.100.200 netmask 255.255.255.0
ifconfig eth0:1 192.168.120.200 netmask 255.255.255.0
ifconfig eth0:2 192.168.130.200 netmask 255.255.255.0

The example above works on linux. On BSD, you need something like:

ifconfig lnc0 192.168.100.200 netmask 255.255.255.0
ifconfig lnc0 192.168.120.200 netmask 255.255.255.0 alias
ifconfig lnc0 192.168.130.200 netmask 255.255.255.0 alias
share|improve this answer
In our university wireless network,the system gives one ip address to each mac address from 8 A.M till 9 P.M ,and the system limits each ip to max of 32KB of speed,if I can make virtual mac address,so it can't detect my laptop as one and it will gives more than one ip address to me. – Moein7tl Oct 1 '11 at 19:23
Please @Moein7tl, edit your question and specify that you are searching a method to get assigned more than one ip address by your university dhcp server. – andcoz Oct 1 '11 at 21:13

Edit: Add hint for setting up virtual device:

First set up an additional device e.g.:

ifconfig eth0:1 up

The you might additionally add an IP to it. e.g.:

ifconfig eth0:1 10.0.0.20 broadcast 10.255.255.255 netmask 255.255.255.255

If you really want to, you can also alter the MAC-address:

$DEVICE="eth0:1"
$MAC="02:73:53:00:ca:fe"
ip link set $DEVICE address $MAC

Note that the second bit of the first byte has to be set to signal a locally administered address (LAA) - which says that this MAC-address is only locally valid (e.g. within your enterprise network) and might not be unique world wide (so you can assign your own MAC-addresses without the need to register them officially).

share|improve this answer
but when I connect to my home wireless network with it,it can only change mac address,and my modem doesn't give me 2 or more ip address.I only see one mac address in my modem pages. – Moein7tl Oct 1 '11 at 20:18
You need to set up an additional virtual device first, of course. That is why I said "also". Look at the answer to your question that outlines ip-aliasing. I prefer using a netmask of 255.255.255.255 for these. But you did not ask for virtual IPs, and sometimes it is enough to have a device up and running with a MAC. – Nils Oct 1 '11 at 20:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.