Difference between revisions of "Networking notes"
Line 68: | Line 68: | ||
You don't need to worry about the broadcast address (or Bcast). By default, it is set to the interface address bitwise OR'ed with the inverse of the netmask. | You don't need to worry about the broadcast address (or Bcast). By default, it is set to the interface address bitwise OR'ed with the inverse of the netmask. | ||
+ | |||
+ | == routing the route == | ||
+ | |||
+ | === add a route === | ||
+ | |||
+ | |||
+ | === display routing table === | ||
+ | |||
+ | On Linux you can use `netstat -rn` or `route` or `ip route`. | ||
+ | |||
+ | I always forget this when I got on a BSD machine. I got some kind of block against this: | ||
+ | |||
+ | <pre> | ||
+ | netstat -rn | ||
+ | </pre> |
Revision as of 12:11, 29 October 2008
This describes permanent Linux network interface settings. That is, settings so that they will be restored after a reboot.
After you make changes you will need to restart the networking subsystem to make the changes active:
/etc/init.d/networking restart
Contents
DHCP
iface eth0 inet dhcp
How to permanently set static IP in Ubuntu
Edit the file:
/etc/network/interfaces
Edit the section for your primary network interface. Example for setting up 192.168.1.66:
auto eth0 iface eth0 inet static address 192.168.1.66 netmask 255.255.255.0 gateway 192.168.1.1
Restart the network layer:
/etc/init.d/networking restart
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 ifcfg-lo
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
You need to restart the network system to have the new settings take effect:
# service network restart
Broadcast
You don't need to worry about the broadcast address (or Bcast). By default, it is set to the interface address bitwise OR'ed with the inverse of the netmask.
routing the route
add a route
display routing table
On Linux you can use `netstat -rn` or `route` or `ip route`.
I always forget this when I got on a BSD machine. I got some kind of block against this:
netstat -rn