Difference between revisions of "Networking notes"

From Noah.org
Jump to navigationJump to search
Line 1: Line 1:
 
[[Category: Engineering]]
 
[[Category: Engineering]]
 
[[Category: Networking]]
 
[[Category: Networking]]
 +
 +
This is, of course, how to set IP addresses from the command-line.
 +
If I can't configure it with a CLI then I don't want to know how to do it.
 +
 
== How to permanently set static IP in Ubuntu ==
 
== How to permanently set static IP in Ubuntu ==
  
Line 8: Line 12:
 
Edit the section for your primary network interface.
 
Edit the section for your primary network interface.
 
It is probably device eth0 or eth1.
 
It is probably device eth0 or eth1.
Say you are on a 192.168.1.0 network and you want to
+
Say you're on a 192.168.1.0 network and you want to
 
set your static IP to 192.168.1.66. These values are typical.
 
set your static IP to 192.168.1.66. These values are typical.
 +
 
   auto eth0
 
   auto eth0
 
   iface eth0 inet static
 
   iface eth0 inet static
Line 17: Line 22:
 
       gateway 192.168.1.1
 
       gateway 192.168.1.1
 
       broadcast 192.168.1.255
 
       broadcast 192.168.1.255
 +
 +
== How to set static IP in RedHat ==
 +
 +
All network config files are in this directory:
 +
 +
  /etc/sysconfig/network-scripts
 +
 +
Each interface will have its own file named after the infterface:
 +
 +
    ifcfg-eth0
 +
    ifcfg-eth1
 +
 +
The contents of a minimal ifcfg-eth0 file looks like this (GATEWAY may not be needed if
 +
you are just setting up a LAN between a few machines):
 +
 +
<pre>
 +
DEVICE=eth0
 +
ONBOOT=yes
 +
BOOTPROTO=static
 +
IPADDR=10.1.0.1
 +
NETMASK=255.255.255.0
 +
GATEWAY=10.0.0.1
 +
</pre>

Revision as of 13:18, 27 July 2007


This is, of course, how to set IP addresses from the command-line. If I can't configure it with a CLI then I don't want to know how to do it.

How to permanently set static IP in Ubuntu

Edit the file:

 /etc/network/interfaces 

Edit the section for your primary network interface. It is probably device eth0 or eth1. Say you're on a 192.168.1.0 network and you want to set your static IP to 192.168.1.66. These values are typical.

 auto eth0
 iface eth0 inet static
     address 192.168.1.66
     network 192.168.1.0
     netmask 255.255.255.0
     gateway 192.168.1.1
     broadcast 192.168.1.255

How to set static IP in RedHat

All network config files are in this directory:

 /etc/sysconfig/network-scripts

Each interface will have its own file named after the infterface:

   ifcfg-eth0
   ifcfg-eth1

The contents of a minimal ifcfg-eth0 file looks like this (GATEWAY may not be needed if you are just setting up a LAN between a few machines):

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.1.0.1
NETMASK=255.255.255.0
GATEWAY=10.0.0.1