I have a router that has eth0 only, and now I want to create an eth1 and assign it IP address.
Is it possible to add new eth ?
I have a router that has eth0 only, and now I want to create an eth1 and assign it IP address.
Is it possible to add new eth ?
of course.
can you tell me how please ? or if these is a link that can help me.
Thanks.
put it in the device, or connect using USB ?
or do you mean https://openwrt.org/packages/pkgdata/kmod-dummy ?
I want to make it without connecting USB or external NIC.
then you probably don't want a new eth, but a virtual interface ?
In other word, I need new physical interface with MAC address, is that possible without external NIC or connecting USB ?
knowing that I create virtual interfaces eth0.1 eth0.2 ... etc , but I want eth1.
depends on what you want to achieve, doesn't it ?
if you want eth1, softlink it ?
Yes its possible. Using the eth0.1 eth0.2 eth0.3 are vlans and probably not what you want. If I'm not mistaken you can by adding the package ip
and kmod-macvlan
add another mac address on the eth0 interface and identify it for system as eth1 or eth2.
opkg update
opkg install ip
opkg install kmod-macvlan
ip link add link eth0 eth1 type macvlan
ifconfig eth1 hw ether 00:11:22:33:44:54
ifup -a
Maybe you do need some script /etc/rc.local
to make the interface come back after reboot not sure.
EDIT:
In case you are using a builtin & managed switch between this interface and a interface on a other host device, you have to obey the strictness/vlan filtering of the switch! By default OpenWrt in a soho router does strict vlan setup as in eth0.1 gives untagged packages out of the strict filtered vlan enabled switch. My guess is that you need to make a 'vlan' on the virtualmacvlan 'eth1' interface as in 'eth1.1' if you want that interface to work ingress/egress its packages on the strict filtered switch just like eth0.1.
vconfig add eth1 1 #to put a vlan1 tag on virtualmacvlan interface
ifconfig -a #shows newly undefined tagged vlan interface as eth1.1
ifconfig eth1.1 192.168.99.1/24 up #example interface
#probably needs /etc/rc.local script to survive reboot
I followed your instructions, and this is the result:
eth0 is Ethernet switch and eth1 is Ethernet adapter, is it correct ?
If you have a soho/consumer router it probably came with a eth0 cpu port, which maybe software bridged to wireless and physically connected to a switch all in the same device.
I'm not sure what router you have or how the interface will look in luci webinterface but I guess it may show as a Switch. Just try to use it and you will see with Wireshark on a external device that packages with other macaddress is in use.
Ok my brother I will follow your instruction.
Thanks
whatever it is you want to achieve you might be able to achieve it with just assigning eth0 a second IP address without the need to create eth1.