0

Fairly new to linux in general, I know enough to be dangerous and thats why I wanted to ask this question here. I am wondering if this is possible. I have 1 nic card. I want to assign 2 ip address's to the same nic card. Neither are internal 192.x.x.x but outside public ips.

OS is 14

Thanks

3
  • Do you want the same card to have both ip addresses at the same time? I'm not sure that's possible...could you explain why you need such an arrangement?
    – TheSchwa
    Sep 10, 2014 at 21:41
  • @Theschwa Check the answer below....
    – Alvar
    Sep 10, 2014 at 21:45
  • @Alvar When I was reviewing it in first posts I didn't see the answer, and a cursory google search didn't show anything helpful. I'll have to make a habit of opening the actual question page during reviews n_n;
    – TheSchwa
    Sep 10, 2014 at 21:49

1 Answer 1

1

You must create an alias for ethernet card.

To create an alias for eth0 you must use ifconfig command. It is use to configure a network interface and aliases.

Example: assuming that your eth0 IP is 10.160.1.10 and you would like to create an alias eth0:1 with IP 10.160.1.11

Open a terminal, and type the following commands:

sudo su
ifconfig eth0:0 10.160.1.11 up

Your ethernet configuration is located in a file called /etc/network/interfaces.

If you reboot system you will lost your alias.

To make it permanent you need to add it network configuration file:

sudo su
nano /etc/network/interfaces

Append the following configuration:

auto eth0:1
iface eth0:1 inet static
address 10.160.1.11
netmask 255.255.255.0
broadcast 10.160.1.255
network 10.160.1.0

Control + O, save file. Control + X, close nano.

Note: If you want more network aliases, use eth0:2, eth0:3, eth0:4, etc.(max upto 254)

3
  • So this will allow 2 ips on the same nic card at the same time. If I ping either, they will respond? Sep 11, 2014 at 1:29
  • I just tried this. I made an exact dupe of what was there except for eth0:1 As soon as my vpn out connected, I lost ssh access. A reboot brought the workstation back as the IP went back to normal. My goal is to have my workstation accessible from inside the house on the local network, while outgoing traffic is going through my vpn. This is why I am in need of 2 ips on 1 nic card and both ips active at same time. Thanks Sep 11, 2014 at 2:16
  • @user1664405 Why do you need two IP's then? don't get it...
    – Alvar
    Sep 11, 2014 at 7:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .