个人工具

UbuntuHelp:NetworkConfigurationCommandLine

来自Ubuntu中文

Wikibot讨论 | 贡献2007年11月30日 (五) 20:47的版本

跳转至: 导航, 搜索

Howto Configure the Network device

The ifconfig tool can set the IP-Address of your network device.

  • sudo ifconfig eth0 192.168.0.xxx ... or whatever you need as IP-Address.

The iwconfig tool is for configuring WLAN devices. Note: These commands will configure your device for the current session, but changes will be lost when you reboot.

Howto Permanently Configure the Network device

To permanently configure your network devices you need to edit the /etc/network/interfaces file. (Type 'man 5 interfaces' to see the manual for the available commands).

Howto Set MTU for a DHCP Connection

Although this is not documented in the manual for interfaces, MTU for a DHCP connected device can be set in the /etc/network/interfaces file. To do so you need to append the 'pre-up' command to the 'iface' section of the relevent interface. eg: iface eth0 inet dhcp pre-up /sbin/ifconfig $IFACE mtu 1492 The above example sets the MTU for device eth0 to 1492, the usual MTU for a PPPoE ISP connection. For a wireless device, you must replace 'ifconfig' with 'iwconfig' in the 'pre-up' command. This tip was found on [1].