Posted By

huckeduster on 11/28/06


Tagged

linux ubuntu networking


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tazjel


How to set a static IP in Ubuntu from the shell


 / Published in: Bash
 

Seen here: http://textsnippets.com/posts/show/319

  1. ### Edit /etc/network/interfaces (in this example setup I will use the IP address 192.168.178.50 for eth0):
  2.  
  3.  
  4. # This file describes the network interfaces available on your system
  5. # and how to activate them. For more information, see interfaces(5).
  6.  
  7. # The loopback network interface
  8. auto lo
  9. iface lo inet loopback
  10.  
  11. # This is a list of hotpluggable network interfaces.
  12. # They will be activated automatically by the hotplug subsystem.
  13. mapping hotplug
  14. script grep
  15. map eth0
  16.  
  17. # The primary network interface
  18. auto eth0
  19. iface eth0 inet static
  20. address 192.168.178.50
  21. netmask 255.255.255.0
  22. network 192.168.178.0
  23. broadcast 192.168.178.255
  24. gateway 192.168.178.1
  25. #optional
  26. #dns-nameserver 102.168.178.1
  27.  
  28.  
  29.  
  30. ### You can also edit /etc/resolv.conf to configure a dns-server to use:
  31.  
  32. nameserver 192.168.178.1

Report this snippet  

You need to login to post a comment.