Stupid Geek Tricks: Change Your IP Address From the Command Line in Linux

Posted by Taylor Gibb on How to geek See other posts from How to geek or by Taylor Gibb
Published on Wed, 11 Jul 2012 08:00:06 GMT Indexed on 2012/07/11 9:18 UTC
Read the original article Hit count: 481

Filed under:
|

image

Almost everybody can figure out how to change their IP address using an interface, but did you know you can set your network card’s IP address using a simple command from the command line?

Changing Your IP From the Command Line in Linux

Note: This will work on all Debian based Linux Distro’s.

To get started type ifconfig into the terminal and hit enter, take note of the name of the interface that you want to change the settings for.

image

To change the settings, you also use the ifconfig command, this time with a few parameters:

sudo ifconfig eth0   192.168.0.1 netmask 255.255.255.0

That’s about all all you need to do to change your IP, of course the above command assumes a few things:

  • The interface that you want to change the IP for is eth0
  • The IP you want to give the interface is 192.168.0.1
  • The Subnet Mask you want to set for the interface is 255.255.255.0

image

If you run ifconfig again you will see that your interface has now taken on the new settings you assigned to it.

image

If you wondering how to change the Default Gateway, you can use the route command.

sudo route add default gw 192.168.0.253 eth0

Will set your Default Gateway on the eth0 interface to 192.168.0.253.

image

To see your new setting, you will need to display the routing table.

route -n

image

That’s all there is to it.

How to Play Classic Arcade Games On Your PC
How to Use an Xbox 360 Controller On Your Windows PC
Download the Official How-To Geek Trivia App for Windows 8


© How to geek or respective owner

Related posts about Other

    Related posts about linux