This trick should work on all Debian-based Linux distros, including Ubuntu. To get started, type ifconfig at the terminal prompt, and then hit Enter. This command lists all network interfaces on the system, so take note of the name of the interface for which you want to change the IP address.

To change the settings, you also use the ifconfig command, this time with a few additional parameters. The following command changes the network interface named “eth1” to use the IP address, and assigns the subnet mask

ifconfig eth1 netmask

You could, of course, substitute in whatever values you want. If you run ifconfig again, you will see that your interface has now taken on the new settings you assigned to it.

If you also need to change the Default Gateway used by the network interface, you can use the route command. The following command, for example, sets the default gateway for the “eth1” interface to

 route add default gw eth1

 To see your new setting, you will need to display the routing table. Type the following command at the prompt, and then hit Enter

 route -n


By anup

Leave a Reply

Your email address will not be published. Required fields are marked *