Linux Networking HOWTO | ||
---|---|---|
Prev | Chapter 5. Generic Network Configuration Information. | Next |
When you have all of the programs you need (and your address and network information), you can configure your network interfaces. When we talk about configuring a network interface, we are talking about two items. One is the process of assigning appropriate addresses to a network device. The second is setting the appropriate values for other configurable parameters of a network device. The program most commonly used to do this is the ifconfig (interface configure) command.
Typically you would use a command similar to the following:
root# ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up |
In this example, I'm configuring an Ethernet interface `eth0' with the IP address `192.168.0.1' and a network mask of `255.255.255.0'. The `up' that trails the command tells the interface that it should become active (but can usually be omitted) since it is the default. To shutdown an interface, you can just call ``ifconfig eth0 down''.
The kernel assumes certain defaults when you are configuring interfaces. For example, you may specify the network address and broadcast address for an interface. If you don't (as in my example above), then the kernel will make reasonable guesses as to what these addresses should be. If you don't supply a netmask then on the network class of the IP address is auto-configured. In my example, the kernel would assume that it is a class-C network that is being configured on the interface. It would thus configure a network address of `192.168.0.0' ,and a broadcast address of `192.168.0.255' for the interface.
There are many other options to the ifconfig command. The most important of these are:
This option activates an interface (and it is the default).
This option deactivates an interface.
This option enables or disables use of the address resolution protocol on this interface .
This option enables or disables the reception of all hardware multicast packets. Hardware multicast enables groups of hosts to receive packets addressed to special destinations. This may be of importance if you are using applications like desktop video conferencing. This option is normally not used.
This parameter allows you to set the MTU of this device.
This parameter allows you to set the network mask of the network. This device belongs to:
This parameter only works on certain types of hardware. It allows you to set the hardware IRQ of this device.
This parameter allows you to enable and set the accepting of datagrams destined to the broadcast address.It also allows you to disable reception of these datagrams.
This parameter allows you to set the address of the machine at the remote end of a Point-to-Point link (ie; for slip or ppp).
This parameter allows you to set the hardware address of certain types of network devices. This is not often useful for Ethernet, but is useful for other network types like AX.25.
With the release of Kernel 2.2, there are a number of options available that are not listed above. Some of the most interesting ones are tunneling and IPV6. The ifconfig parameters for kernel 2.2 are listed below.
The name of the interface. This is usually a driver name followed by a unit number. For example, eth0 for the first Ethernet interface.
This flag causes the interface to be activated. It is implicitly specified if an address is assigned to the interface.
This flag causes the driver for this interface to be shut down.
Enables or disables the use of the ARP protocol on this interface.
Enables or disables the promiscuous mode of the interface. If selected, all packets on the network will be received by the interface.
Enables or disables all-multicast mode. If selected, all multicast packets on the network will be received by the interface.
This parameter sets the interface metric.
This parameter sets the Maximum Transfer Unit (MTU) of an interface.
Sets the remote IP address for a point-to-point link (such as PPP). This keyword is now obsolete; you should now use the pointopoint keyword.
Sets the IP network mask for this interface. This value defaults to the usual class A, B or C network mask (as derived from the interface IP address). It can, however, be set to any value.
Adds an IPv6 address to an interface.
Removes an IPv6 address from an interface.
Creates a new SIT (IPv6-in-IPv4) device that tunnels to the given destination.
Sets the interrupt line used by this device. Not all devices can dynamically change their IRQ set- ting.
Sets the start address in I/O space for this device.
Set the start address for shared memory used by this device. Only a few devices need this parameter.
Sets the physical port (or medium type) to be used by the device. Not all devices can change this set- ting. Those that can change the setting vary in what values they support. Typical values for type are 10base2 (thin Ethernet), 10baseT (twisted-pair 10Mbps Ethernet), AUI (external transceiver) and so on. The special medium type of auto can be used to tell the driver to auto-sense the media. Again, not all drivers can do this.
If the address argument is given, set the protocol broadcast address for this interface. Otherwise, set (or clear) the IFF_BROADCAST flag for the interface.
This keyword enables the point-to-point mode of an interface. This means that it is a direct link between two machines, and that nobody else is listening on it. If the address argument is also given, set the pro- tocol address of the other side of the link ( just as the obsolete dstaddr keyword does). Otherwise, set or clear the IFF_POINTOPOINT flag for the interface.
Set the hardware address of this interface (if the device driver supports this operation). The keyword must be followed by the name of the hardware class and the printable ASCII equivalent of the hardware address. Hardware classes currently supported include ether (Ethernet), ax25 (AMPR AX.25), ARCnet and netrom (AMPR NET/ROM).
Set the multicast flag on the interface. This should not normally be needed because the drivers set the flag correctly themselves.
The IP address to be assigned to this interface.
Sets the length of the transmit queue of the device. It is useful to set this to small values for slower devices with a high latency (modem links, ISDN). This prevents fast bulk transfers from disturbing inter- active traffic (like telnet) too much.
You may use the ifconfig command on any network interface. Some user programs such as pppd and dip automatically configure the network devices as they create them, so manual use of ifconfig is unnecessary.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |