Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Introduction

...

Add Additional Static IP Address

First make sure you know how your current IP Address setting looks,

ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:16:3c:3f:68:7f  
          inet addr:64.73.220.110  Bcast:64.73.220.255  Mask:255.255.255.0
          inet6 addr: fe80::216:3cff:fe3f:687f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1677062 errors:0 dropped:952 overruns:0 frame:0
          TX packets:11659 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:88552695 (88.5 MB)  TX bytes:2706451 (2.7 MB)
# you will see more but ignore
 
cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

Key things to note is your ethernet card device name (usually eth0) and Mask.

Temporary to Test

You may use the ifconfig or ip command. I prefer the ifconfig so you do not need to calculate the netmask from Dotted Decimal to Bitmask (Bits). In this example, we will add 64.73.220.110 to the existing ethernet card.

# syntax ifconfig [nic]:0 [IP-Address] netmask [mask] up
sudo ifconfig eth0:0 64.73.220.111 netmask 255.255.255.0 up
 
# verify new address shows up,
ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:16:3c:3f:68:7f brd ff:ff:ff:ff:ff:ff
    inet 64.73.220.110/24 brd 64.73.220.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 64.73.220.111/24 scope global secondary eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::216:3cff:fe3f:687f/64 scope link 
       valid_lft forever preferred_lft forever
3: lxcbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether fe:33:d8:e0:ef:6b brd ff:ff:ff:ff:ff:ff
    inet 10.0.3.1/24 brd 10.0.3.255 scope global lxcbr0
       valid_lft forever preferred_lft forever
    inet6 fe80::b06f:d2ff:fe9d:49be/64 scope link 
       valid_lft forever preferred_lft forever
5: vethHVREWV: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master lxcbr0 state UP group default qlen 1000
    link/ether fe:33:d8:e0:ef:6b brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc33:d8ff:fee0:ef6b/64 scope link 
       valid_lft forever preferred_lft forever

Test using the ping command from your a client machine.

Add a permanent IP Address

 

References

Best article yet - https://www.garron.me/en/linux/add-secondary-ip-linux.html


# syntax ifconfig [nic]:0 [IP-Address] netmask [mask] upsudo ifconfig eth0:0 64.73.220.110 netmask 255.255.255.0 up

  • No labels