0

i wonder if i am able to change the public IP address via Terminal and not losing connection, for some reasons I'd prefer writing a program to change the public IP address multiple times per unit of time, is that possible?

Ryan Doherty
  • 1,029
  • Short answer: no, not on your computer. You have to log into your router's admin console and if there is an option for that, renew public ip or simply reboot router to reconnect – Sergiy Kolodyazhnyy Dec 08 '16 at 19:25

1 Answers1

0

You can not change your public IP address via terminal because your public IP is allocated by your ISP. Depending on your ISP it can be static (meaning it doesn't change) or dynamic where it can randomly change.

If you want to change your IP address on your local network, get the name of your network interface with ifconfig and then you can change it with

sudo ifconfig nameOfInterface desiredIPAddress 255.255.255.0

An example would look like

sudo ifconfig enp3s0 192.168.1.227 255.255.255.0

NOTE: 255.255.255.0 is your netmask. Chances are that's what it is

Ryan Doherty
  • 1,029