目录
![]() |
提示 |
---|---|
关于GNU/Linux网络的通用手册,请查看Linux 网络管理员手册。 |
![]() |
提示 |
---|---|
关于Debian专属的网络手册,请查看Debian管理员手册—网络配置。 |
![]() |
警告 |
---|---|
Instead of using the traditional interface naming scheme
(" |
![]() |
警告 |
---|---|
本章是基于 2013 年发布的 Debian 7.0 ( |
![]() |
提示 |
---|---|
尽管本手册仍用旧的
ifconfig(8)
命令和IPv4协议当作网络配置的例子,Debian在 |
让我们来回顾一下现代Debian操作系统中的基本网络架构。
表 5.1. 网络配置工具一览表
软件包 | 流行度 | 大小 | 类型 | 说明 |
---|---|---|---|---|
ifupdown
|
V:568, I:995 | 204 | 配置::ifupdown | 用来启动/关闭网络的标准工具(Debian特有) |
ifplugd
|
V:4, I:18 | 209 | 同上 | 自动管理有线网络 |
ifupdown-extra
|
V:0, I:1 | 96 | 同上 |
网络测试脚本,加强"ifupdown "软件包的功能
|
ifmetric
|
V:0, I:1 | 21 | 同上 | 设置网络接口的路由度量 |
guessnet
|
V:0, I:1 | 402 | 同上 |
脚本文件,利用"/etc/network/interfaces "文件来加强"ifupdown "的功能
|
ifscheme
|
V:0, I:0 | 58 | 同上 |
映射脚本文件,增强"ifupdown "软件包的功能
|
ifupdown-scripts-zg2
|
V:0, I:0 | 147 | 同上 | Zugschlus写的脚本,用于ifupdown手动管理 |
network-manager
|
V:365, I:473 | 10959 | 配置::NM | NetworkManager(守卫进程):自动管理网络 |
network-manager-gnome
|
V:243, I:418 | 6132 | 同上 | NetworkManager(GNOME前端) |
wicd
|
I:35 | 34 | 配置::wicd | 有线和无线网络管理器(元软件包) |
wicd-cli
|
V:0, I:2 | 58 | 同上 | 有线和无线网络管理器(命令行客户端) |
wicd-curses
|
V:1, I:5 | 174 | 同上 | 有线和无线网络管理器(文本界面客户端) |
wicd-daemon
|
V:29, I:40 | 951 | 同上 | 有线和无线网络管理器(守护进程) |
wicd-gtk
|
V:24, I:37 | 573 | 同上 | 有线和无线网络管理器(GTK+客户端) |
iptables
|
V:243, I:996 | 1475 | 配置::Netfilter | 封包过滤和网络地址转换管理工具(Netfilter) |
iproute
|
V:144, I:550 | 23 | 配置::iproute2 | iproute2, IPv6和其他高级网络配置:ip(8),tc(8)等等 |
ifrename
|
V:1, I:2 | 121 | 同上 | 根据不同的静态标准来重命名网络接口:ifrename(8) |
ethtool
|
V:91, I:261 | 331 | 同上 | 显示或更改以太网设备的设定 |
iputils-ping
|
V:268, I:997 | 106 | 测试::iproute2 | 测试能否连接远程主机,通过主机名或IP 地址(iproute2) |
iputils-arping
|
V:67, I:384 | 57 | 同上 | 测试能否连接远程主机,通过ARP地址 |
iputils-tracepath
|
V:17, I:288 | 90 | 同上 | 跟踪访问远程主机的路径 |
net-tools
|
V:427, I:998 | 883 | 配置::net-tools | NET-3网络工具箱(net-tools,IPv4网络配置):ifconfig(8)等等。 |
inetutils-ping
|
V:0, I:1 | 337 | 测试::net-tools | 测试能否连接远程主机,通过hostname或IP 地址(传统方式,GNU) |
arping
|
V:2, I:28 | 103 | 同上 | 测试能否连接远程主机,通过ARP地址(传统方法) |
traceroute
|
V:74, I:993 | 154 | 同上 | 跟踪连接远程主机的路径(传统方法,控制台) |
isc-dhcp-client
|
V:420, I:959 | 651 | 配置::底层 | DHCP客户端 |
wpasupplicant
|
V:279, I:547 | 2531 | 同上 | WPA和WPA2客户端支持(IEEE 802.11i) |
wpagui
|
V:0, I:4 | 781 | 同上 | wpa_supplicant Qt 图形界面客户端 |
wireless-tools
|
V:81, I:276 | 265 | 同上 | 操控Linux无线扩展的工具 |
ppp
|
V:203, I:519 | 927 | 同上 |
使用chat 连接PPP/PPPoE
|
pppoeconf
|
V:0, I:12 | 290 | 配置::辅助 | 配置助手,以便于使用PPPoE连接 |
pppconfig
|
V:1, I:4 | 805 | 同上 |
配置助手,以便于使用chat 连接PPP
|
wvdial
|
V:0, I:8 | 276 | 同上 |
配置助手,以便于使用wvdial 和ppp 连接PPP
|
mtr-tiny
|
V:7, I:59 | 105 | 测试::底层 | 追踪连接远程主机的路径(文本界面) |
mtr
|
V:6, I:41 | 150 | 同上 | 追踪连接远程主机的路径(文本界面和GTK+界面) |
gnome-nettool
|
V:14, I:285 | 2111 | 同上 | 获取常见网络信息的工具(GNOME) |
nmap
|
V:47, I:454 | 22207 | 同上 | 网络映射/端口扫描(Nmap,控制台) |
zenmap
|
V:3, I:12 | 2821 | 同上 | 网络映射/端口扫描(GTK+) |
tcpdump
|
V:22, I:198 | 1120 | 同上 | 网络流量分析(Tcpdump,控制台) |
wireshark
|
V:6, I:65 | 72 | 同上 | 网络流量分析(Wireshark,GTK+) |
tshark
|
V:3, I:37 | 363 | 同上 | 网络流量分析(控制台) |
nagios3
|
I:8 | 9 | 同上 | 主机、服务、网络监控及管理系统(Nagios) |
tcptrace
|
V:0, I:1 | 389 | 同上 |
根据tcpdump 的输出生成的连接数据统计
|
snort
|
V:1, I:1 | 1920 | 同上 | 灵活的网络入侵侦测系统(Snort) |
ntopng
|
V:0, I:1 | 578 | 同上 | 在网页浏览器中展示网络流量 |
dnsutils
|
V:82, I:903 | 462 | 同上 | BIND软件包提供的网络客户端程序:nslookup(8),nsupdate(8),dig(8) |
dlint
|
V:1, I:23 | 96 | 同上 | 利用域名服务器查询来查看DNS域信息 |
dnstracer
|
V:0, I:2 | 81 | 同上 | 跟踪DNS查询直至源头 |
The hostname resolution is currently supported by the NSS (Name Service Switch) mechanism too. The flow of this resolution is the following.
The "/etc/nsswitch.conf
" file with stanza like
"hosts: files dns
" dictates the hostname resolution
order. (This replaces the old functionality of the
"order
" stanza in "/etc/host.conf
".)
The files
method is invoked first. If the hostname is
found in the "/etc/hosts
" file, it returns all valid
addresses for it and exits. (The "/etc/host.conf
" file
contains "multi on
".)
The dns
method is invoked. If the hostname is found by
the query to the Internet Domain
Name System (DNS) identified by the
"/etc/resolv.conf
" file, it returns all valid addresses
for it and exits.
For example, "/etc/hosts
" looks like the following.
127.0.0.1 localhost 127.0.1.1 <host_name> # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
Each line starts with a IP address and it is followed by the associated hostname.
The IP address 127.0.1.1
in the second line of this
example may not be found on some other Unix-like systems. The Debian Installer creates this entry for a
system without a permanent IP address as a workaround for some software
(e.g., GNOME) as documented in the bug
#719621.
The <host_name> matches the hostname defined in the
"/etc/hostname
".
For a system with a permanent IP address, that permanent IP address should
be used here instead of 127.0.1.1
.
For a system with a permanent IP address and a fully qualified domain name (FQDN) provided by the Domain Name System (DNS), that canonical <host_name>.<domain_name> should be used instead of just <host_name>.
The "/etc/resolv.conf
" is a static file if the
resolvconf
package is not installed. If installed, it is
a symbolic link. Either way, it contains information that initialize the
resolver routines. If the DNS is found at
IP="192.168.11.1
", it contains the following.
nameserver 192.168.11.1
The resolvconf
package makes this
"/etc/resolv.conf
" into a symbolic link and manages its
contents by the hook scripts automatically.
For the PC workstation on the typical adhoc LAN environment, the hostname
can be resolved via Multicast DNS (mDNS, Zeroconf) in addition to the basic
files
and dns
methods.
Avahi provides a framework for Multicast DNS Service Discovery on Debian.
It is equivalent of Apple Bonjour / Apple Rendezvous.
The libnss-mdns
plugin package provides host name
resolution via mDNS for the GNU Name Service Switch (NSS) functionality of
the GNU C Library (glibc).
The "/etc/nsswitch.conf
" file should have stanza like
"hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
".
Host names ending with the ".local" pseudo-top-level domain (TLD) are resolved.
The mDNS IPv4 link-local multicast address "224.0.0.251
"
or its IPv6 equivalent "FF02::FB
" are used to make DNS
query for a name ending with ".local
".
The hostname resolution via deprecated NETBios over TCP/IP used by the older
Windows system can be provided by installing the winbind
package. The "/etc/nsswitch.conf
" file should have
stanza like "hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
wins
" to enable this functionality. (Modern Windows system
usually use the dns
method for the hostname resolution.)
![]() |
注意 |
---|---|
The expansion of generic Top-Level Domains (gTLD) in the Domain Name System is underway. Watch out for the name collision when chosing a domain name used only within LAN. |
The network interface name, e.g. eth0
, is assigned to
each hardware in the Linux kernel through the user space configuration
mechanism, udev
(see 第 3.3 节 “udev 系统”),
as it is found. The network interface name is referred as physical interface in
ifup(8)
and
interfaces(5).
In order to ensure each network interface to be named persistently for each
reboot using MAC address etc., there is a
rules file "/etc/udev/rules.d/70-persistent-net.rules
".
This file is automatically generated by the
"/lib/udev/write_net_rules
" program, probably run by the
"persistent-net-generator.rules
" rules file. You can
modify it to change naming rule.
![]() |
小心 |
---|---|
When editing the
" |
Let us be reminded of the IPv4 32 bit address ranges in each class reserved for use on the local area networks (LANs) by rfc1918. These addresses are guaranteed not to conflict with any addresses on the Internet proper.
表 5.2. 网络地址范围列表
类别 | 网络地址 | 子网掩码 | 子网掩码/位数 | # 子网数 |
---|---|---|---|---|
A | 10.x.x.x | 255.0.0.0 | /8 | 1 |
B | 172.16.x.x — 172.31.x.x | 255.255.0.0 | /16 | 16 |
C | 192.168.0.x — 192.168.255.x | 255.255.255.0 | /24 | 256 |
![]() |
注意 |
---|---|
If one of these addresses is assigned to a host, then that host must not access the Internet directly but must access it through a gateway that acts as a proxy for individual services or else does Network Address Translation (NAT). The broadband router usually performs NAT for the consumer LAN environment. |
尽管 Debian 系统支持大多数硬件设备,但依旧有一些网络设备需要 DFSG non-free 固件来支持它们。参见 第 9.9.6 节 “Hardware drivers and firmware”。
Debian squeeze
和新的发行版都可以通过后台守护进程(daemon)管理软件来管理网络连接,例如 NetworkManager (NM)(network-manager
和相关软件包)或 Wicd(wicd 和相关软件包)。
它们有自己的 GUI 和命令行程序来作为用户界面。
它们有自己的后台守护进程(daemon)作为它们的系统后端。
它们使你可以简单地将系统连接到网络。
它们使你可以简单地管理有线和无线网络的配置。
它们允许你配置网络而不依赖传统的 ifupdown
软件包。
![]() |
注意 |
---|---|
不要在服务器上使用这些自动网络配置工具。它们主要针对于笔记本电脑上的移动桌面用户。 |
这些现代的网络配置工具需要进行适当的配置,以避免与传统 ifupdown
软件包发生冲突,它的配置文件位于
“/etc/network/interfaces
”。
![]() |
提示 |
---|---|
使用 systemd 的系统中,可以在
|
![]() |
注意 |
---|---|
Some features of these automatic network configuration tools may suffer
regressions. These are not as robust as the legacy
|
Debian 系统 NM 和 Wicd 的官方文档分别位于
“/usr/share/doc/network-manager/README.Debian
” 和
“/usr/share/doc/wicd/README.Debian
”。
本质上,如下操作即可完成桌面的网络配置。
通过下列命令使桌面用户 foo
归属 “netdev
” 组(另外,例如
GNOME 和 KDE 这样的现代桌面环境会通过 D-bus 自动完成该操作)。
$ sudo adduser foo netdev
使 “/etc/network/interfaces
” 的配置保持下面那样简洁。
auto lo iface lo inet loopback
通过下列命令重新启动 NM 或 Wicd。
$ sudo /etc/init.d/network-manager restart
$ sudo /etc/init.d/wicd restart
通过图形界面配置网络。
![]() |
注意 |
---|---|
只有不列在
“ |
![]() |
提示 |
---|---|
如果你想扩展 NM 的网络配置功能,请寻找适当的插件模块和补充软件包,例如
|
![]() |
小心 |
---|---|
这些自动网络配置工具可能无法兼容 “ |
如果 第 5.2 节 “现代的桌面网络配置” 中描述的方法无法满足你的需要,那你应该使用结合了许多普通工具的传统网络连接和配置方法。
传统网络连接的每个方法都是特定的(参见 第 5.4 节 “网络连接方式(传统)”)。
用于 Linux 底层网络配置的程序有两种类型(参见 第 5.7.1 节 “Iproute2 命令”)。
来自 Linux NET-3 网络系统的旧 net-tools 程序(ifconfig(8)……)。它们中的大多数都已经过时了。
来自现在的 Linux 网络系统的新 Linux iproute2 程序(ip(8)……)。
尽管底层程序十分强大,但它们使用繁琐。因此创建了高层网络配置系统。
ifupdown
软件包是 Debian 中这种高层网络配置系统的实际标准。它让你可以简单地通过例如
“ifup eth0
” 这样的命令来打开网络。它的配置文件位于
“/etc/network/interfaces
” 中并且其典型内容如下。
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp
resolvconf
软件包是为了使 ifupdown
系统支持自动重写解析器配置文件 “/etc/resolv.conf
” 来使网络地址解析平滑地重新配置。现在,大多数
Debian 网络配置软件包都使用了 resolvconf
软件包(参见
“/usr/share/doc/resolvconf/README.Debian
”)。
ifupdown
软件包的辅助脚本,例如
ifplugd
、guessnet
、ifscheme
等,是为了进行网络环境的自动动态配置,例如位于有线局域网中的移动电脑。这些相对来说比较难使用,但在当前的
ifupdown
系统下工作良好。
详细的案例参见 第 5.5 节 “使用 ifupdown 进行基本网络配置(旧)” 和 第 5.6 节 “使用 ifupdown 的高级网络配置(旧)”。
![]() |
小心 |
---|---|
在这节描述的连接测试方式仅仅用于测试目的。不应当直接用于日常的网络连接。建议你使用 NM, Wicd, 或
|
一台电脑典型的网络连接方式和连接路径,能够使用下面的内容概述。
表 5.3. 网络连接方式和连接路径列表
PC | 连接方式 | 连接路径 |
---|---|---|
串口 (ppp0 )
|
PPP | ⇔ modem ⇔ POTS ⇔ 拨号接入点 ⇔ ISP |
以太网口 (eth0 )
|
PPPoE/DHCP/Static | ⇔ 宽带-modem ⇔ 宽带链路 ⇔ 宽带接入点 ⇔ ISP |
以太网口 (eth0 )
|
DHCP/Static | ⇔ LAN ⇔ 网络地址转换 (NAT) 的宽带路由器 (⇔ 宽带-modem …) |
每种连接方式配置脚本汇总。
表 5.4. 网络连接配置列表
连接方式 | 配置 | 后端包 |
---|---|---|
PPP | pppconfig 创建固定的 chat
|
pppconfig , ppp |
PPP (选用) | wvdialconf 创建启发式的 chat
|
ppp , wvdial |
PPPoE | pppoeconf 创建固定的 chat
|
pppoeconf , ppp |
DHCP |
在 "/etc/dhcp/dhclient.conf " 里描述
|
isc-dhcp-client
|
静态 IP (IPv4) |
在 "/etc/network/interfaces " 里描述
|
iproute 或 net-tools (旧)
|
静态 IP (IPv6) |
在 "/etc/network/interfaces " 里描述
|
iproute
|
网络连接缩略语意义如下。
![]() |
注意 |
---|---|
通过电视线缆的广域网服务,通常使用 DHCP 或 PPPoE。ADSL 和 FTTP 通常使用 PPPoE。你需要咨询你的互联网服务提供商来获得广域网连接使用的精确配置。 |
![]() |
注意 |
---|---|
当宽带路由器用来搭建家庭局域网环境时,局域网上的电脑需要使用宽带路由器上的 网络地址转换(NAT),来连接到广域网。在这样的情况下,局域网上的电脑网络接口需使用静态 IP 或者宽带路由器提供的 DHCP 服务。宽带路由器必须按 ISP 的指引来配置连接到广域网。 |
典型的现代家庭和小的商业网络,也就是局域网,使用一些消费等级的宽带路由器连接到广域网(因特网)。路由器后面的局域网通常使用路由器上运行的动态主机配置协议(DHCP) 服务端提供的服务。
仅仅需要安装 isc-dhcp-client
包为以太网提供动态主机配置协议 (DHCP)服务。
参见 dhclient.conf(5).
配置脚本 pppconfig
配置 PPP
连接,仅需要交互式的选择下面内容。
电话号码
ISP 用户名
ISP 密码
端口速率
modem 通信端口
认证方式
表 5.6. 使用 pppconfig 的 PPP 连接配置文件列表
![]() |
小心 |
---|---|
"<isp_name>" 是 " |
你可以使用下面的底层网络配置工具测试配置。
$ sudo pon <isp_name> ... $ sudo poff <isp_name>
参见 "/usr/share/doc/ppp/README.Debian.gz
".
一个不同的使用pppd(8)
方案是使用来自 wvdial
包的
wvdial(1)。代替
pppd
运行
chat(8)
来拨号和协商连接,wvdial
进行拨号和初始化协商,然后启动 pppd
进行余下操作。
配置脚本 wvdialconf
配置 PPP 连接,仅需要交互式的选择下面内容。
电话号码
ISP 用户名
ISP 密码
在大部分情况下,wvdial
能够成功建立连接并自动维护认证鉴权数据。
你可以使用下面的底层网络配置工具测试配置。
$ sudo wvdial ... $ sudo killall wvdial
参见 wvdial(1) 和 wvdial.conf(5).
当你的互联网提供商提供 PPPoE 连接,并且你决定把电脑直接连接到广域网,那你的电脑网络必须使用 PPPoE 来配置。PPPoE 表示以太网上的
PPP。配置脚本pppoeconf
交互式的配置 PPPoE 连接。
配置文件在下面。
你可以使用下面的底层网络配置工具测试配置。
$ sudo /sbin/ifconfig eth0 up $ sudo pon dsl-provider ... $ sudo poff dsl-provider $ sudo /sbin/ifconfig eth0 down
参见 "/usr/share/doc/pppoeconf/README.Debian
".
Debian 系统上的传统 TCP/IP 网络
搭建,ifupdown
软件包是作为一个上层工具来使用。有两个典型场景。
像移动电脑上的 动态 IP 系统,你可以使用 resolvconf
包搭建 TCP/IP
网络,它能够使你快速切换你的网络配置。 (参见 第 5.5.4 节 “使用 DHCP 的网络接口”).
像服务器上的 静态 IP 系统,你不需要 resolvconf
包来搭建你的 TCP/IP
网络,并保持你的系统简单(参见 第 5.5.5 节 “使用静态 IP 地址的网络接口”).
如果你想设置高级配置,这些传统的设置方法,是相当有用的。在下面的内容中发现细节。
ifupdown
包提供 Debian 系统中标准的高层网络配置框架。在本节中,我们通过
ifupdown
的简单介绍和许多典型列子来学习基本的网络配置。
ifupdown
包包含有两个命令:
ifup(8)
和
ifdown(8).
它们提供专注于"/etc/network/interfaces" 配置文件的上层网络配置。
表 5.9. 使用 ifupdown 进行基本网络配置的命令列表
命令 | 操作 |
---|---|
ifup eth0
|
如果 "iface eth0 " 节存在,使用 eth0
的配置来启动网络接口 eth0
|
ifdown eth0
|
如果 "iface eth0 " 节存在,使用 eth0 的配置来关闭网络接口
eth0
|
![]() |
警告 |
---|---|
请不要使用 ifconfig(8) 和 ip(8) 这类的底层网络配置工具命令来配置一个 up 状态的接口。 |
![]() |
注意 |
---|---|
并没有一个叫 |
在
interfaces(5)
里解释的 "/etc/network/interfaces
" 关键语法,能够用下面的表格概括。
表 5.10. "/etc/network/interfaces
" 里面的节列表
节 | 说明 |
---|---|
"auto <interface_name> "
|
当系统启动时,启动接口 < interface_name> |
"allow-auto <interface_name> "
|
同上 |
"allow-hotplug <interface_name> "
|
当内核从接口检测到一个热拔插事件时,启动接口 <interface_name> |
"iface <config_name> … " 开头的行
|
定义 <config_name> 的网络配置 |
"mapping <interface_name_glob> " 开头的行
|
定义 <config_name> 的映射值来匹配 <interface_name> |
"# " 号开始的行
|
像注释一样忽略(行尾注释不被支持) |
"\ " 反斜杠结尾的行
|
扩展配置到下一行 |
以 iface
开头行的节,有下面的语法。
iface <config_name> <address_family> <method_name> <option1> <value1> <option2> <value2> ...
对于基本配置, mapping
节没有被使用,你可以使用网络接口名作为网络配置名。 (参见 第 5.6.5 节 “The mapping stanza”).
![]() |
警告 |
---|---|
在
" |
在启动系统的时候, "/etc/network/interfaces
" 文件里下面的配置条目启动了回环网络接口
lo
。 (通过 auto
节).
auto lo iface lo inet loopback
这节内容在 "/etc/network/interfaces
" 文件里面一直存在。
按 第 5.4.1 节 “以太网 DHCP 连接”
准备系统后,在"/etc/network/interfaces
" 里面,按下面的内容创建配置条目后,网络接口的
DHCP 便配置好了。
allow-hotplug eth0 iface eth0 inet dhcp
当 Linux 内核检测到物理接口 eth0
, allow-hotplug
节促使
ifup
启动接口,iface
促使 ifup
使用 DHCP 来配置接口。
在 "/etc/network/interfaces
" 文件里面创建配置条目,来配置静态 IP
网络接口。如下所示。
allow-hotplug eth0 iface eth0 inet static address 192.168.11.100 netmask 255.255.255.0 gateway 192.168.11.1 dns-domain example.com dns-nameservers 192.168.11.1
当 Linux 内核检测到 eth0
, allow-hotplug
节促使
ifup
启动接口,iface
节促使
ifup
使用静态 IP 来配置接口。
这里,我假设下面的配置。
局域网的 IP 地址范围: 192.168.11.0
-
192.168.11.255
网关的 IP 地址: 192.168.11.1
电脑的 IP 地址: 192.168.11.100
resolvconf
包:已安装
域名: "example.com
"
DNS 服务器的 IP 地址:192.168.11.1
当 resolvconf
包没有安装时,DNS 相关的配置,需要按下面的方式手工编辑
"/etc/resolv.conf
" 。
nameserver 192.168.11.1 domain example.com
![]() |
小心 |
---|---|
用在上面例子里的 IP 地址,不意味着照抄。你应当按你实际网络配置调整 IP 地址。 |
无线 LAN (简称 WLAN) 提供快速的无线连接,使用基于 IEEE 802.11 标准集的非授权无线宽带扩频通信技术。
无线接口跟以太网接口非常像,但在初始化时,要求提供一些网络 ID
和密钥数据。他们的上层网络工具差不多和以太网接口一样,除开接口名有一点点不同,按使用的不同内核驱动,像 eth1
, wlan0
, ath0
,
wifi0
……
![]() |
提示 |
---|---|
|
这里有一些需要记住的 WLAN 关键词。
表 5.11. WLAN 缩写词列表
缩略语 | 全称 | 说明 |
---|---|---|
NWID | Network ID | 802.11 之前 WaveLAN 网络使用的 16 位网络号 (强烈不赞成使用) |
(E)SSID | (Extended) Service Set Identifier | 无线接入点 (APs) 的网络名称,互连形成一个完整的 802.11 无线局域网, 域名 ID |
WEP, (WEP2) | Wired Equivalent Privacy | 使用 40 位密钥的第一代 64位(128位)无线加密标准(不赞成使用) |
WPA | Wi-Fi Protected Access | 第二代无线加密标准(实现大部分 802.11i),和 WEP 兼容 |
WPA2 | Wi-Fi Protected Access 2 | 第三代无线加密标准(完全的 802.11i),与 WEP 不兼容 |
实际选择使用的协议是由你配置的无线路由器所限制。
你需要安装 wpasupplicant
包来支持 WLAN 使用新的 WPA/WPA2.
使用 DHCP
的无线局域网连接,"/etc/network/interfaces
" 文件的条目需要按下面的内容设置。
allow-hotplug ath0 iface ath0 inet dhcp wpa-ssid homezone # hexadecimal psk is encoded from a plaintext passphrase wpa-psk 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
参见 "/usr/share/doc/wpasupplicant/README.modes.gz
".
你需要安装 wireless-tools
包来支撑老的 WEP
无线局域网。(你的消费等级的路由器可能仍然使用不安全的架构,但这总比没有好。)
![]() |
小心 |
---|---|
请注意:WEP 无线局域网上的网络流量,可以被其他人监听。 |
使用 DHCP
的无线局域网连接,"/etc/network/interfaces
" 文件的条目需要按下面的内容设置。
allow-hotplug eth0 iface eth0 inet dhcp wireless-essid Home wireless-key1 0123-4567-89ab-cdef wireless-key2 12345678 wireless-key3 s:password wireless-defaultkey 2 wireless-keymode open
参见 "/usr/share/doc/wireless-tools/README.Debian
".
你需要按之前的描述配置 PPP 连接(参见 第 5.4.3 节 “使用 pppconfig 的 PPP 连接”). 然后,按下面的方式给第一个 PPP 设备
ppp0
增加 “/etc/network/interfaces
"
文件里的条目.
iface ppp0 inet ppp provider <isp_name>
你需要按之前的描述先配置好使用 wvdial
的另外一种 PPP 连接(参见第 5.4.4 节 “使用 wvdialconf 的另一种可选的 PPP 连接”). 然后,按下面的方式给第一个
PPP 设备 ppp0
增加
“/etc/network/interfaces
" 文件里的条目.
iface ppp0 inet wvdial
使用 PPPoE 直接连接到广域网的电脑,你需要按之前的描述用 PPPoE 连接配置系统(参见 第 5.4.5 节 “使用 pppoeconf 的 PPPoE 以太网连接”). 然后,按下面的方式给第一个 PPPoE 设备
eth0
增加 “/etc/network/interfaces
"
文件里的条目.
allow-hotplug eth0 iface eth0 inet manual pre-up /sbin/ifconfig eth0 up up ifup ppp0=dsl down ifdown ppp0=dsl post-down /sbin/ifconfig eth0 down # The following is used internally only iface dsl inet ppp provider dsl-provider
The "/etc/network/run/ifstate
" file stores the intended network configuration states for all the
currently active network interfaces managed by the
ifupdown
package. Unfortunately, even if the
ifupdown
system fails to bring up the interface as
intended, the "/etc/network/run/ifstate
" file lists it
active.
Unless the output of the ifconfig(8) command for an interface does not have a line like following example, it can not be used as a part of IPV4 network.
inet addr:192.168.11.2 Bcast:192.168.11.255 Mask:255.255.255.0
![]() |
注意 |
---|---|
For the Ethernet device connected to the PPPoE, the output of the ifconfig(8) command lacks a line which looks like above example. |
当你试图重新配置接口,如 eth0
时,你必须首先用 "sudo ifdown eth0
" 命令关闭它.
这将从"/etc/network/run/ifstate
" 文件里面移除
eth0
条目。 (如果 eth0
之前没有被适当配置,或没有激活,这个命令将导致出现一些错误信息。迄今为止,对于简单的单用户工作站,在任何时间执行这个操作,看起来都是安全的。)
你现在可以按需要重新配置网络接口 eth0
,重写
"/etc/network/interfaces
" 文件的内容。
然后,你可以使用 "sudo ifup
eth0
" 命令,重新激活 eth0
。
![]() |
提示 |
---|---|
你可以简单的执行 " |
ifupdown-extra
包提供简易的网络连接测试,和 ifupdown
包一道使用.
network-test(1) 命令能够在 shell 里使用。
自动脚本将运行每一个 ifup
执行的命令。
network-test
命令把你从麻烦的执行分析网络问题的底层命令中解放出来。
自动脚本安装在 " /etc/network/*/
"并执行下面的操作。
检查网络线缆连接
检查重复 IP 地址使用
按 "/etc/network/routes
" 的定义,建立系统静态路由
检查网络的网关是否可以到达
在 "/var/log/syslog
" 文件里面记录结果
系统日志记录对管理远程系统的网络问题非常有用。
![]() |
提示 |
---|---|
|
The functionality of the ifupdown
package can be improved
beyond what was described in 第 5.5 节 “使用 ifupdown 进行基本网络配置(旧)” with the
advanced knowledge.
The functionalities described here are completely optional. I, being lazy and minimalist, rarely bother to use these.
![]() |
小心 |
---|---|
If you could not set up network connection by information in 第 5.5 节 “使用 ifupdown 进行基本网络配置(旧)”, you make situation worse by using information below. |
The ifplugd
package is an older automatic network
configuration tool which can manage only Ethernet connections. This solves
unplugged/replugged Ethernet cable issues for mobile PC etc. If you have
NetworkManager or Wicd (see 第 5.2 节 “现代的桌面网络配置”) installed, you do
not need this package.
This package runs a daemon and replaces
auto or allow-hotplug functionalities (see 表 5.10 “"/etc/network/interfaces
" 里面的节列表”) and starts interfaces upon their
connection to the network.
Here is how to use the ifplugd
package for the internal
Ethernet port, e.g. eth0
.
Remove stanza in "/etc/network/interfaces
":
"auto eth0
" or "allow-hotplug eth0
".
Keep stanza in "/etc/network/interfaces
": "iface
eth0 inet …
" and "mapping …
".
Install the ifplugd
package.
Run "sudo dpkg-reconfigure ifplugd
".
Put eth0
as the "static interfaces to be watched by
ifplugd".
Now, the network reconfiguration works as you desire.
Upon power-on or upon hardware discovery, the interface is not brought up by itself.
Quick boot process without the long DHCP timeout.
No funny activated interface without proper IPv4 address (see 第 5.5.12 节 “ifupdown 网络配置状态”).
Upon finding the Ethernet cable, the interface is brought up.
Upon some time after unplugging the Ethernet cable, the interface is brought down automatically.
Upon plugging in another Ethernet cable, the interface is brought up under the new network environment.
![]() |
提示 |
---|---|
The arguments for the ifplugd(8) command can set its behaviors such as the delay for reconfiguring interfaces. |
The ifmetric
package enables us to manipulate metrics of
routes a posteriori even for DHCP.
The following sets the eth0
interface to be preferred
over the wlan0
interface.
Install the ifmetric
package.
Add an option line with "metric 0
" just below the
"iface eth0 inet dhcp
" line in
"/etc/network/interfaces
".
Add an option line with "metric 1
" just below the
"iface wlan0 inet dhcp
" line in
"/etc/network/interfaces
".
The metric 0 means the highest priority route and is the default one. The larger metric value means lower priority routes. The IP address of the active interface with the lowest metric value becomes the originating one. See ifmetric(8).
A single physical Ethernet interface can be configured as multiple virtual interfaces with different IP addresses. Usually the purpose is to connect an interface to several IP subnetworks. For example, IP address based virtual web hosting by a single network interface is one such application.
For example, let's suppose the following.
A single Ethernet interface on your host is connected to a Ethernet hub (not to the broadband router).
The Ethernet hub is connected to both the Internet and LAN network.
The LAN network uses subnet 192.168.0.x/24
.
Your host uses DHCP served IP address with the physical interface
eth0
for the Internet.
Your host uses 192.168.0.1
with the virtual interface
eth0:0
for the LAN.
The following stanzas in "/etc/network/interfaces
"
configure your network.
iface eth0 inet dhcp metric 0 iface eth0:0 inet static address 192.168.0.1 netmask 255.255.255.0 network 192.168.0.0 metric 1
![]() |
小心 |
---|---|
Although this configuration example with network address translation (NAT) using netfilter/iptables (see 第 5.9 节 “Netfilter infrastructure”) can provide cheap router for the LAN with only single interface, there is no real firewall capability with such set up. You should use 2 physical interfaces with NAT to secure the local network from the Internet. |
The ifupdown
package offers advanced network
configuration using the network
configuration name and the network
interface name. I use a terminology being slightly different
from the one used in
ifup(8)
and
interfaces(5).
表 5.12. List of terminology for network devices
manpage terminology | my terminology | examples in the following text | 说明 |
---|---|---|---|
physical interface name | network interface name | lo , eth0 ,
<interface_name> |
name given by the Linux kernel (using udev mechanism)
|
logical interface name | network configuration name | config1 , config2 ,
<config_name> |
name token following iface in the
"/etc/network/interfaces "
|
Basic network configuration commands in 第 5.5.1 节 “简单的命令语法” require the network configuration name token of the iface
stanza to match the
network interface name in the
"/etc/network/interfaces
".
Advanced network configuration commands enables separation of the network configuration name and the network interface name in the
"/etc/network/interfaces
" as the following.
表 5.13. List of advanced network configuration commands with ifupdown
命令 | 操作 |
---|---|
ifup eth0=config1
|
bring up a network interface eth0 with the configuration
config1
|
ifdown eth0=config1
|
bring down a network interface eth0 with the
configuration config1
|
ifup eth0
|
bring up a network interface eth0 with the configuration
selected by mapping
stanza
|
ifdown eth0
|
bring down a network interface eth0 with the
configuration selected by mapping stanza
|
We skipped explaining the mapping
stanza in the
"/etc/network/interfaces
" in 第 5.5.2 节 “"/etc/network/interfaces" 基本语法” to avoid
complication. This stanza has the following syntax.
mapping <interface_name_glob> script <script_name> map <script_input1> map <script_input2> map ...
This provides advanced features to the
"/etc/network/interfaces
" file by automating the choice
of the configuration with the mapping script specified by
<script_name>
.
Let's follow the execution of the following.
$ sudo ifup eth0
When the "<interface_name_glob>
" matches
"eth0
", this execution produces the execution of the
following command to configure eth0
automatically.
$ sudo ifup eth0=$(echo -e '<script_input1> \n <script_input2> \n ...' | <script_name> eth0)
Here, script input lines with "map
" are optional and can
be repeated.
![]() |
注意 |
---|---|
The glob for |
以下是如何在几个网络配置中进行手动切换,而无需像 第 5.5.13 节 “网络重新配置基础” 中那样重写
“/etc/network/interfaces
” 文件。
对于你需要访问的所有网络配置,你需要在 “/etc/network/interfaces
”
文件中像下面那样创建一个单独的节。
auto lo iface lo inet loopback iface config1 inet dhcp iface config2 inet static address 192.168.11.100 netmask 255.255.255.0 gateway 192.168.11.1 dns-domain example.com dns-nameservers 192.168.11.1 iface pppoe inet manual pre-up /sbin/ifconfig eth0 up up ifup ppp0=dsl down ifdown ppp0=dsl post-down /sbin/ifconfig eth0 down # The following is used internally only iface dsl inet ppp provider dsl-provider iface pots inet ppp provider provider
Please note the network configuration
name which is the token after iface
does not use the token for
the network interface name. Also, there
are no auto
stanza nor
allow-hotplug
stanza
to start the network interface eth0
automatically upon
events.
现在,你可以切换网络配置了。
让我们通过 DHCP 将你的 PC 移动到局域网。你可以通过下列命令开启由网络配置名称(逻辑接口名称)config1
指定的网络接口(物理接口) eth0
。
$ sudo ifup eth0=config1 Password: ...
eth0
接口已开启,由 DHCP 配置并连接到了局域网。
$ sudo ifdown eth0=config1 ...
eth0
接口已关闭并断开局域网连接。
让我们通过静态 IP 使你的 PC 移动到局域网。你可以通过下列命令开启由网络配置名称 config2
指定的网络接口 eth0
。
$ sudo ifup eth0=config2 ...
开启 eth0
接口,使用静态 IP 配置并连接到局域网。像 dns-*
这样的额外参数会配置 “/etc/resolv.conf
” 的内容。如果安装了
resolvconf
,“/etc/resolv.conf
” 会更容易管理。
$ sudo ifdown eth0=config2 ...
eth0
接口再次关闭并断开局域网连接。
让我们将你的 PC 移动到 PPPoE 服务器的 BB-modem 上的一个端口。你可以通过下列命令开启由网络配置名称 pppoe
指定的网络接口 eth0
。
$ sudo ifup eth0=pppoe ...
eth0
接口已开启,由 PPPoE 配置直接连接到 ISP。
$ sudo ifdown eth0=pppoe ...
eth0
接口再次关闭并断开连接。
让我们将你的 PC 移动到使用 POTS 和 modem 的位置,而非局域网或 BB-modem。你可以通过下列命令开启由网络配置名称 ppp0
指定的网络接口 eth0
。
$ sudo ifup ppp0=pots ...
开启 ppp0
接口,并使用 PPP 连接到互联网。
$ sudo ifdown ppp0=pots ...
关闭 ppp0
接口并断开网络。
你应该检查 “/etc/network/run/ifstate
”
文件,查看ifupdown
系统当前网络配置的状态。
![]() |
警告 |
---|---|
如果你有多个网络接口,你可能需要调整 |
ifupdown
系统会自动运行安装在 “/etc/network/*/
”
中的脚本,而且会传递环境变量给脚本。
表 5.14. ifupdown 系统传递的环境变量
环境变量 | 传递值 |
---|---|
"$IFACE "
|
处理中的接口的物理名称(接口名称) |
"$LOGICAL "
|
处理中的接口的逻辑名称(配置名称) |
"$ADDRFAM "
|
接口的 <address_family> |
"$METHOD "
|
接口的 <method_name> (例如 “static”) |
"$MODE "
|
如果是 ifup 运行的,则值为 “start”;如果是 ifdown
运行的,则值为 “stop”
|
"$PHASE "
|
根据 “$MODE ”,但有更细致的区分,共分为
pre-up 、post-up 、pre-down
和 post-down 阶段
|
"$VERBOSITY "
|
指示是否使用了 “--verbose ”;是为 1,否为 0
|
"$PATH "
|
命令搜索路径:“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ”
|
"$IF_<OPTION> "
|
value for the corresponding option under the iface stanza
|
Here, each environment variable, "$IF_<OPTION>
", is
created from the name for the corresponding option such as <option1>
and <option2> by prepending "$IF_
", converting the
case to the upper case, replacing hyphens to underscores, and discarding
non-alphanumeric characters.
![]() |
提示 |
---|---|
See 第 5.5.2 节 “"/etc/network/interfaces" 基本语法” for <address_family>, <method_name>, <option1> and <option2>. |
The ifupdown-extra
package (see 第 5.5.14 节 “ifupdown-extra 包”) uses these environment variables to
extend the functionality of the ifupdown
package. The
ifmetric
package (see 第 5.6.2 节 “The ifmetric package”) installs the
"/etc/network/if-up.d/ifmetric
" script which sets the
metric via the "$IF_METRIC
" variable. The
guessnet
package (see 第 5.6.8 节 “Mapping with guessnet”), which provides simple and powerful
framework for the auto-selection of the network configuration via the
mapping mechanism, also uses these.
![]() |
注意 |
---|---|
For more specific examples of custom network configuration scripts using
these environment variables, you should check example scripts in
" |
Instead of manually choosing configuration as described in 第 5.6.6 节 “手动的可切换网络配置”, you can use the mapping mechanism described in 第 5.6.5 节 “The mapping stanza” to select network configuration automatically with custom scripts.
The
guessnet-ifupdown(8)
command provided by the guessnet
package is designed to
be used as a mapping script and provides powerful framework to enhance the
ifupdown
system.
You list test condition as the value for guessnet
options for each
network configuration under iface
stanza.
Mapping choses the iface
with first non-ERROR
result as the network configuration.
This dual usage of the "/etc/network/interfaces
" file by
the mapping script, guessnet-ifupdown
, and the original
network configuration infrastructure, ifupdown
, does not
cause negative impacts since guessnet
options only export
extra environment variables to scripts run by the
ifupdown
system. See details in
guessnet-ifupdown(8).
![]() |
注意 |
---|---|
When multiple |
Iproute2 命令集提供完整的底层网络配置能力。有个从旧的 net-tools 命令集到新的 iproute2 命令集的转换表。
表 5.15. 从旧的 net-tools
命令集到新的 iproute2
命令集转换表
旧的 net-tools | 新的 iproute2 | 操作 |
---|---|---|
ifconfig(8) |
ip addr
|
一个设备上的协议(IP 或 IPv6)地址 |
route(8) |
ip route
|
路由表条目 |
arp(8) |
ip neigh
|
ARP 或 NDISC 缓存条目 |
ipmaddr
|
ip maddr
|
多播地址 |
iptunnel
|
ip tunnel
|
IP 隧道 |
nameif(8) | ifrename(8) | 基于 MAC 地址的网络接口名 |
mii-tool(8) | ethtool(8) | 以太网设备设置 |
参见 ip(8) 和 IPROUTE2 工具套件 Howto.
你可以按下面的方式安全的使用底层网络命令,这些命令不会改变网络配置。
表 5.16. 底层网络命令列表
命令 | 说明 |
---|---|
ifconfig
|
显示活动的网络接口连接和地址状态 |
ip addr show
|
显示活动的网络接口连接和地址状态 |
route -n
|
用数字地址显示全部路由表 |
ip route show
|
用数字地址显示全部路由表 |
arp
|
显示当前 ARP 缓存表的内容 |
ip neigh
|
显示当前 ARP 缓存表的内容 |
plog
|
显示 ppp 后台守护进程(daemon)日志 |
ping yahoo.com
|
检查到 "yahoo.com " 的因特网连接
|
whois yahoo.com
|
在域名数据库里面检查谁注册了 "yahoo.com "
|
traceroute yahoo.com
|
跟踪到 "yahoo.com " 的因特网连接
|
tracepath yahoo.com
|
跟踪到 "yahoo.com " 的因特网连接
|
mtr yahoo.com
|
跟踪到 "yahoo.com " 的因特网连接(重复的)
|
dig [@dns-server.com] example.com [{a|mx|any}]
|
查询由 "dns-server.com " 提供服务的
"example.com " 域名的 DNS 记录:
"a ", "mx " 或 "any "
记录
|
iptables -L -n
|
查看包过滤 |
netstat -a
|
找出所有打开的端口 |
netstat -l --inet
|
找出监听端口 |
netstat -ln --tcp
|
找出 TCP 监听端口(数字的) |
dlint example.com
|
查询 "example.com " 的 DNS zone 信息
|
![]() |
提示 |
---|---|
部分底层网络配置工具放在 " |
Generic network optimization is beyond the scope of this documentation. I touch only subjects pertinent to the consumer grade connection.
表 5.17. 网络优化工具列表
软件包 | 流行度 | 大小 | 说明 |
---|---|---|---|
iftop
|
V:9, I:109 | 93 | display bandwidth usage information on an network interface |
iperf
|
V:5, I:53 | 160 | Internet Protocol bandwidth measuring tool |
apt-spy
|
V:0, I:3 | 105 |
write a "/etc/apt/sources.list " file based on bandwidth
tests
|
ifstat
|
V:1, I:10 | 55 | InterFace STATistics Monitoring |
bmon
|
V:1, I:12 | 143 | portable bandwidth monitor and rate estimator |
ethstatus
|
V:0, I:3 | 39 | script that quickly measures network device throughput |
bing
|
V:0, I:2 | 57 | empirical stochastic bandwidth tester |
bwm-ng
|
V:1, I:16 | 89 | small and simple console-based bandwidth monitor |
ethstats
|
V:0, I:1 | 20 | console-based Ethernet statistics monitor |
ipfm
|
V:0, I:0 | 78 | bandwidth analysis tool |
The Maximum Transmission Unit
(MTU) value can be determined experimentally with
ping(8)
with "-M do
" option which sends ICMP packets with data
size starting from 1500 (with offset of 28 bytes for the IP+ICMP header) and
finding the largest size without IP fragmentation.
尝试下列例子
$ ping -c 1 -s $((1500-28)) -M do www.debian.org PING www.debian.org (194.109.137.218) 1472(1500) bytes of data. From 192.168.11.2 icmp_seq=1 Frag needed and DF set (mtu = 1454) --- www.debian.org ping statistics --- 0 packets transmitted, 0 received, +1 errors
Try 1454 instead of 1500
You see ping(8) succeed with 1454.
This process is Path MTU (PMTU) discovery (RFC1191) and the tracepath(8) command can automate this.
![]() |
提示 |
---|---|
The above example with PMTU value of 1454 is for my previous FTTP provider which used Asynchronous Transfer Mode (ATM) as its backbone network and served its clients with the PPPoE. The actual PMTU value depends on your environment, e.g., 1500 for the my new FTTP provider. |
表 5.18. Basic guide lines of the optimal MTU value
network environment | MTU | rationale |
---|---|---|
Dial-up link (IP: PPP) | 576 | standard |
Ethernet link (IP: DHCP or fixed) | 1500 | standard and default |
Ethernet link (IP: PPPoE) | 1492 (=1500-8) | 2 bytes for PPP header and 6 bytes for PPPoE header |
Ethernet link (ISP's backbone: ATM, IP: DHCP or fixed) | 1462 (=48*31-18-8) | author's speculation: 18 bytes for Ethernet header, 8 bytes for SAR trailer |
Ethernet link (ISP's backbone: ATM, IP: PPPoE) | 1454 (=48*31-8-18-8) | see "Optimal MTU configuration for PPPoE ADSL Connections" for rationale |
In addtion to these basic guide lines, you should know the following.
Any use of tunneling methods (VPN etc.) may reduce optimal MTU further by their overheads.
The MTU value should not exceed the experimentally determined PMTU value.
The bigger MTU value is generally better when other limitations are met.
Here are examples for setting the MTU value from its default 1500 to 1454.
For the DHCP (see 第 5.5.4 节 “使用 DHCP 的网络接口”), you can replace
pertinent iface
stanza
lines in the "/etc/network/interfaces
" with the
following.
iface eth0 inet dhcp pre-up /sbin/ifconfig $IFACE mtu 1454
For the static IP (see 第 5.5.5 节 “使用静态 IP 地址的网络接口”), you can replace
pertinent iface
stanza
lines in the "/etc/network/interfaces
" with the
following.
iface eth0 inet static address 192.168.11.100 netmask 255.255.255.0 gateway 192.168.11.1 mtu 1454 dns-domain example.com dns-nameservers 192.168.11.1
For the direct PPPoE (see 第 5.4.5 节 “使用 pppoeconf 的 PPPoE 以太网连接”), you can replace pertinent
"mtu
" line in the
"/etc/ppp/peers/dsl-provider
" with the following.
mtu 1454
The maximum segment size (MSS) is used as an alternative measure of packet size. The relationship between MSS and MTU are the following.
MSS = MTU - 40 for IPv4
MSS = MTU - 60 for IPv6
![]() |
注意 |
---|---|
The iptables(8) (see 第 5.9 节 “Netfilter infrastructure”) based optimization can clamp packet size by the MSS and is useful for the router. See "TCPMSS" in iptables(8). |
The TCP throughput can be maximized by adjusting TCP buffer size parameters as described in "TCP Tuning Guide" and "TCP tuning" for the modern high-bandwidth and high-latency WAN. So far, the current Debian default settings serve well even for my LAN connected by the fast 1G bps FTTP service.
Netfilter provides infrastructure for stateful firewall and network address translation (NAT) with Linux kernel modules (see 第 3.3.1 节 “内核模块初始化”).
表 5.19. List of firewall tools
软件包 | 流行度 | 大小 | 说明 |
---|---|---|---|
iptables
|
V:243, I:996 | 1475 | administration tools for netfilter (iptables(8) for IPv4, ip6tables(8) for IPv6) |
arptables
|
V:0, I:2 | 124 | administration tools for netfilter (arptables(8) for ARP) |
ebtables
|
V:30, I:56 | 358 | administration tools for netfilter (ebtables(8) for Ethernet bridging) |
iptstate
|
V:0, I:4 | 115 | continuously monitor netfilter state (similar to top(1)) |
shorewall-init
|
I:0 | 76 | Shoreline Firewall initialization |
shorewall
|
V:7, I:17 | 2293 | Shoreline Firewall, netfilter configuration file generator |
shorewall-lite
|
V:0, I:0 | 84 | Shoreline Firewall, netfilter configuration file generator (light version) |
shorewall6
|
V:0, I:2 | 880 | Shoreline Firewall, netfilter configuration file generator (IPv6 version) |
shorewall6-lite
|
V:0, I:0 | 82 | Shoreline Firewall, netfilter configuration file generator (IPv6, light version) |
Main user space program of netfilter is iptables(8). You can manually configure netfilter interactively from shell, save its state with iptables-save(8), and restore it via init script with iptables-restore(8) upon system reboot.
Configuration helper scripts such as shorewall ease this process.
See documentations at http://www.netfilter.org/documentation/
(or in "/usr/share/doc/iptables/html/
").
![]() |
提示 |
---|---|
Although these were written for Linux 2.4, both iptables(8) command and netfilter kernel function apply for Linux 2.6 and 3.x kernel series. |