Advertisement
SH1NU11b1

Static ip creation

Oct 23rd, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1.  
  2. This tutorial explains how to set a static IP on an Ubuntu system from the command line.
  3.  
  4.  
  5.  
  6. Step 1
  7. 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:
  8.  
  9. You can copy and paste directly from this line.
  10.  
  11. sudo nano /etc/network/interfaces
  12.  
  13. Enter your root password, once your prefered editor opens the file you can see...
  14.  
  15. auto lo eth0
  16. iface lo inet loopback
  17. iface eth0 inet dynamic
  18. If you have more than one network card, please be sure to make changes to the correct network interface.
  19.  
  20. Statically configured network cards will have a section like:
  21.  
  22. auto lo eth0
  23. iface lo inet loopback
  24. iface eth0 inet static
  25. address xxx.xxx.xxx.xxx(enter your ip here)
  26. netmask xxx.xxx.xxx.xxx
  27. gateway xxx.xxx.xxx.xxx(enter gateway ip here,usually the address of the router)
  28. If you use "nano" editor, type Ctrl+x to save changes.
  29.  
  30. Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
  31.  
  32. <---Type "y"
  33.  
  34. File Name to Write: interfaces
  35.  
  36. <---ENTER
  37.  
  38. Here is an example:
  39.  
  40. auto lo eth0
  41. iface lo inet loopback
  42. iface eth0 inet static
  43. address 192.168.1.101
  44. netmask 255.255.255.0
  45. gateway 192.168.1.1
  46.  
  47.  
  48. Step 2
  49. In this step you will manually configure your dns configuration file.
  50.  
  51. sudo nano /etc/resolv.conf
  52.  
  53. Once your editor opens the file you want to enter the following information...
  54.  
  55. nameserver xxx.xxx.xxx.xxx(enter your dns server ip)
  56. nameserver xxx.xxx.xxx.xxx(enter your alt dns server ip)
  57. If you use "nano" editor, type Ctrl+x to save changes.
  58.  
  59. Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
  60.  
  61. <---Type "y"
  62.  
  63. File Name to Write: resolv.conf
  64.  
  65. <---ENTER
  66.  
  67. Here is an example:
  68.  
  69. nameserver 213.60.205.175
  70. nameserver 213.60.205.173
  71.  
  72.  
  73. Step 3
  74. Manually restart your network interface with the new settings:
  75.  
  76. sudo /etc/init.d/networking restart
  77.  
  78. This should return a result that looks like the following:
  79.  
  80. *Reconfiguring network interfaces… [OK]
  81.  
  82. At this point you can check if the settings are correct:
  83.  
  84. ifconfig
  85.  
  86. If everything is correct you will get this result.
  87.  
  88. eth0 Link encap:Ethernet direcciónHW 00:33:27:46:2v:34
  89. Direc. inet:192.168.1.101 Difus.:0.0.0.0 Másc:255.255.255.0
  90. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement