Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This tutorial explains how to set a static IP on an Ubuntu system from the command line.
- Step 1
- In this step you will manually configure your network interface by editing the following files using your preferred text editor(nano gedit vi). For the purpose of this example I am using the "nano" editor. You can edit the appropriate file by entering the following command into the terminal:
- You can copy and paste directly from this line.
- sudo nano /etc/network/interfaces
- Enter your root password, once your prefered editor opens the file you can see...
- auto lo eth0
- iface lo inet loopback
- iface eth0 inet dynamic
- If you have more than one network card, please be sure to make changes to the correct network interface.
- Statically configured network cards will have a section like:
- auto lo eth0
- iface lo inet loopback
- iface eth0 inet static
- address xxx.xxx.xxx.xxx(enter your ip here)
- netmask xxx.xxx.xxx.xxx
- gateway xxx.xxx.xxx.xxx(enter gateway ip here,usually the address of the router)
- If you use "nano" editor, type Ctrl+x to save changes.
- Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
- <---Type "y"
- File Name to Write: interfaces
- <---ENTER
- Here is an example:
- auto lo eth0
- iface lo inet loopback
- iface eth0 inet static
- address 192.168.1.101
- netmask 255.255.255.0
- gateway 192.168.1.1
- Step 2
- In this step you will manually configure your dns configuration file.
- sudo nano /etc/resolv.conf
- Once your editor opens the file you want to enter the following information...
- nameserver xxx.xxx.xxx.xxx(enter your dns server ip)
- nameserver xxx.xxx.xxx.xxx(enter your alt dns server ip)
- If you use "nano" editor, type Ctrl+x to save changes.
- Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
- <---Type "y"
- File Name to Write: resolv.conf
- <---ENTER
- Here is an example:
- nameserver 213.60.205.175
- nameserver 213.60.205.173
- Step 3
- Manually restart your network interface with the new settings:
- sudo /etc/init.d/networking restart
- This should return a result that looks like the following:
- *Reconfiguring network interfaces… [OK]
- At this point you can check if the settings are correct:
- ifconfig
- If everything is correct you will get this result.
- eth0 Link encap:Ethernet direcciónHW 00:33:27:46:2v:34
- Direc. inet:192.168.1.101 Difus.:0.0.0.0 Másc:255.255.255.0
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement