I connect my Macbook pro to internet through Lan and if I type ifconfig in terminal my en0 interface get valid IP now I want add en1, en2 and en3 to my configuration and they all be able to get valid IPs, I don't want to add additional network card I just want to use my internal network card. I don't know if I must use bridging or nating or ... . please help find my solution.
-
Tell us what end you are trying to achieve, because I don't understand what you're after. Why do you want to have multiple ways (en0, en1, en2...) to refer to a single interface? If you want multiple IP addresses on the same interface, that is doable.– AlanGBakerCommented Nov 6, 2011 at 9:20
2 Answers
In System Preferences
-> Network
click on the +
to add a new interface, in the popup choose Ethernet
.
This will not create an additional en1
or en2
interface, but add an additional address to your en0
interface.
What you are looking for is called IP address aliasing. In Mac OSX you can create an aliased address by issuing the following command (see the ifconfig manpage for more details):
sudo ifconfig en0 alias $ADDRESS $NETMASK
However, you cannot receive DHCP leases on these "virtual NICs" (see here for why) so you will need to have an available static IP address and know the appropriate gateway, all information you can get from your ISP. Depending on what your ISP's upstream subnetting and routing looks like you may also have to add a static route (see the route manapage).
-
Changes made with ifconfig tend to get overwritten by OS X's config daemon -- it's better to make settings changes with System Preferences or
networksetup
, and then let configd apply them. Commented Nov 6, 2011 at 17:06