0

I got very confused about network interfaces. My laptop has only 1 network interface card with just 1 port. So I assume it is 1 mac address. When router using its routing table to route packet to my laptop it sends it to a registered mac address port. So, in theory, my pc can have "virtual interfaces" and each can have it is own IP address?

Example: Currently my pc has, Npcap adapter, Virtual box adapter, 2 blank ethernet adapters.

Question: Can I just manually create an adapter and pretend to be the second machine on the network?

Doug Deden
  • 1,844
  • 7
  • 10
Anton Stafeyev
  • 340
  • 2
  • 3
  • 13

1 Answers1

1

You can uses the macvlan or the ipvlan interfaces, but this isn't required. You can assign the several addresses on single interface. Second way is more simple because you don't need manage multiple interfaces with overlapping subnets.

  1. In this case the macvlan the virtual interface has own mac and ip address. If you want use this virtual interface to connect to same lan segment the configuration is not trivial. Prefer this way to connect to different subnet within single broadcast domain.

Detailed description you can find here

  1. Assigning of multiple address from same subnet on the same interface is pretty simple:
ip address add <ip2>/<prefixlen> dev <iface>
ip address add <ip3>/<prefixlen> dev <iface>
ip address add <ip4>/<prefixlen> dev <iface>
Anton Danilov
  • 5,082
  • 2
  • 13
  • 23
  • oh hi again Anton, thanks for your answer. how about creating a bottleneck ? will it cause traffic impedance? – Anton Stafeyev Jul 10 '19 at 08:18
  • First way require complex routing setup and theoretically can cause issues. Second way is completely safe. – Anton Danilov Jul 10 '19 at 08:27
  • if i add new interface with ip command and i have 4 physical ports on my nic, can i bind it to a specific port using that ip command? – Anton Stafeyev Jul 10 '19 at 08:29
  • Depends of type the virtual interface. Some types doesn't require binding to physical interface (like dummy interfaces). For other types you can specify physical interface at creation. Check `man ip-link`. – Anton Danilov Jul 10 '19 at 08:32