LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   temporary Ip address (https://www.linuxquestions.org/questions/linux-newbie-8/temporary-ip-address-4175580190/)

kohshan99 05-19-2016 01:27 PM

temporary Ip address
 
how to add temporary ip address? right now
Quote:

root@HP-Z400-Workstation:~# ifconfig
eth1 Link encap:Ethernet HWaddr d0:50:99:0f:9c:9e
inet addr:192.168.172.131 Bcast:192.168.172.135 Mask:255.255.255.248
inet6 addr: fe80::d250:99ff:fe0f:9c9e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1411930572 errors:0 dropped:0 overruns:0 frame:0
TX packets:2256205206 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:127270888272 (127.2 GB) TX bytes:1562113750858 (1.5 TB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:15952 errors:0 dropped:0 overruns:0 frame:0
TX packets:15952 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2434458 (2.4 MB) TX bytes:2434458 (2.4 MB)
but when i add temporary ip address, getting this error
Quote:

root@HP-Z400-Workstation:~# ip address add 202.175.165.124 dev eth0:0
Cannot find device "eth0:0"

lazydog 05-19-2016 02:18 PM

Copy ifcfg-eth0 to ifcfg-eth0:0 and change the ip address. Then run ifup eth0:0

michaelk 05-19-2016 03:04 PM

The syntax is different when using the ip versus ifconfig commands. You can add multiple addresses without them being an "alias". Since eth0 was not shown in the output of the ifconfig is it enabled? You can add a temp address like below. Change the numbers to match your network.

ip addr add 192.168.0.2/24 brd 192.168.0.255 dev eth0

To see eth0:0 when using the ifconfig command:
ip addr add 192.168.0.2/24 brd 192.168.0.255 dev eth0 label eth0:0

kohshan99 05-20-2016 02:30 AM

thanks to everyone.
i solved it by just changing eth0:0 to eth1:0. because my primary ip interface is on eth1 so i can use eth1:0 to eth1:1, eth1:2, eth1:3.

like this
Quote:

root@HP-Z400-Workstation:~# ip address add 202.175.165.124 dev eth1:0


All times are GMT -5. The time now is 04:40 AM.