0

On Debian Linux dist I need two IP address with different mac address. On each of them one server will run on port 80. So i need something like this:

ip: 192.168.2.1 mac: xx:xx:xx:10:xx:xx
ip: 192.168.2.2 mac: xx:xx:xx:90:xx:xx

And then start two http servers each listen one ip address.

Already have eth0 setup to proper ip address and i tried to setup virtual network adapter via macvlan:

ip link add link eth0 name vlan0 type macvlan mode private
ip address add 192.168.2.2 dev vlan0 
ip link set dev vlan0 address xx:xx:xx:90:xx:xx
ip link set dev vlan0 up

When i enter url 192.168.2.2 i get same page as 192.168.2.1. So basically everything on port 80 is routed to that server. I also tried all different modes of macvlan but result is always same.

What am i doing wrong? Is this even possible with macvlan or i need different approach?

0

well, that is not a big deal as you can easily to do this by creating virtual interfaces on single physical interface.

you can simply do this as follow:

ifconfig wlan0:if1 <IP> <NM>
ifconfig wlan0:if2 <IP> <NM>

I used ifconfig but you can use ip link the same way.

alternatively you can create the interfaces file entries manually as follow:

 vi /etc/sysconfig/network-scripts/ifcfg-wlan0

  DEVICE=wlan0
  BOOTPROTO=static
  IPADDR=192.168.1.2
  NETMASK=255.255.255.0
  ONBOOT=yes

  vi /etc/sysconfig/network-scripts/ifcfg-wlan0:1

  DEVICE=wlan0:1
  BOOTPROTO=static
  IPADDR=192.168.1.3
  NETMASK=255.255.255.0
  ONBOOT=yes

However, it is not best practice to assign the same subnet/IP to virtual interfaces, I'd suggest to use separate vlan like 192.168.2.x

0

It sounds like what you want to do is MAC spoofing. In your case, you should do as ostendali suggested and create two virtual interfaces and then spoof the mac on them. That is a pretty simple thing to do. There are some simple instructions here.

Though it is a little unclear, I'll take a stab in the dark here. You also mention that you want separate servers running on the different interfaces and that they will be using port 80. Sounds like you are trying to host multiple websites on one server. Apache2 is a pretty popular choice so here is a walkthrough for hosting multiple sites. Good Luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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