This simple blog post is on how to do it.
Step 1 :
Type ifconfig in console to list down the current network configurations. It will display as below.
enp0s25: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 54:ee:75:83:7e:a6 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xf1200000-f1220000
enp0s25:1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.100.0.24 netmask 255.255.255.0 broadcast 10.100.0.255
ether 54:ee:75:83:7e:a6 txqueuelen 1000 (Ethernet)
device interrupt 20 memory 0xf1200000-f1220000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 1295 bytes 168545 (164.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1295 bytes 168545 (164.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.124.1 netmask 255.255.255.0 broadcast 192.168.124.255
ether 52:54:00:a3:65:c6 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.100.0.24 netmask 255.255.255.0 broadcast 10.100.0.255
inet6 fe80::1a5e:fff:fed4:229a prefixlen 64 scopeid 0x20<link>
ether 18:5e:0f:d4:22:9a txqueuelen 1000 (Ethernet)
RX packets 307132 bytes 230860558 (220.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 187836 bytes 37165700 (35.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp4s0:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.2 netmask 255.255.255.0 broadcast 0.0.0.0
ether 18:5e:0f:d4:22:9a txqueuelen 1000 (Ethernet)
Step 2 :
Add your address in to your network interface using below command.
192.168.1.3 is my new IP and wlp4s0 is my network interface.
ip addr add 192.168.1.3/24 dev wlp4s0 label wlp4s0:1
Step 3 :
Use ip addr show command to display the current addresses.
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: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 54:ee:75:83:7e:a6 brd ff:ff:ff:ff:ff:ff
inet 10.100.0.24/24 brd 10.100.0.255 scope global enp0s25:1
valid_lft forever preferred_lft forever
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 18:5e:0f:d4:22:9a brd ff:ff:ff:ff:ff:ff
inet 10.100.0.24/24 brd 10.100.0.255 scope global dynamic wlp4s0
valid_lft 2897sec preferred_lft 2897sec
inet 192.168.1.2/24 scope global wlp4s0:0
valid_lft forever preferred_lft forever
inet 192.168.1.3/24 scope global secondary wlp4s0:1
valid_lft forever preferred_lft forever
inet6 fe80::1a5e:fff:fed4:229a/64 scope link
valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 52:54:00:a3:65:c6 brd ff:ff:ff:ff:ff:ff
inet 192.168.124.1/24 brd 192.168.124.255 scope global virbr0
valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 500
link/ether 52:54:00:a3:65:c6 brd ff:ff:ff:ff:ff:ff
Step 4:
If you want you can even add it in to your host entries.
Add host entries to /etc/hosts
192.168.1.2 testhost1.com
Step 5 :
Ping to your new IP address to make sure they respond
ping 192.168.1.3
PING 192.168.1.3 (192.168.1.3) 56(84) bytes of data.
64 bytes from 192.168.1.3: icmp_seq=1 ttl=64 time=0.036 ms
64 bytes from 192.168.1.3: icmp_seq=2 ttl=64 time=0.038 ms
64 bytes from 192.168.1.3: icmp_seq=3 ttl=64 time=0.038 ms
64 bytes from 192.168.1.3: icmp_seq=4 ttl=64 time=0.062 ms
64 bytes from 192.168.1.3: icmp_seq=5 ttl=64 time=0.082 ms
No comments:
Post a Comment