Next Previous Contents

11. 核心設定 in /proc-filesystem

11.1 怎樣進入 /proc-filesystem

使用 "cat"和 "echo"

使用 "cat"和 "echo" 是進入 /proc-filesystem的最簡單方法. 但必需具備下面幾個條件:

通常/proc/sys/* 都是可寫的, 其它的都是只讀或只提供相關資訊.

得到一個值

可以使用 "cat" 得到一個值.


# cat /proc/sys/net/ipv6/conf/all/forwarding
0

設定一個值

可以使用 "echo" 設定一個值.


# echo "1" >/proc/sys/net/ipv6/conf/all/forwarding

使用 "sysctl"

使用 "sysctl" 設定核心是當前流行的方法, 您也能用. 如果/proc-filesystem 沒有掛進來, 那麼您只可以訪問/proc/sys/*

"sysctl"程式在"procps"安裝包中.(Red Hat Linux systems)

sysctl-interface 需要在核心中進行激活, 在編譯的時候可以通過以下選項完成:


CONFIG_SYSCTL=y

設定一個值

A new value can be set (if entry is writable):


# sysctl -w net.ipv6.conf.all.forwarding=1
net.ipv6.conf.all.forwarding = 1

在 "=" 兩邊不能出現spaces符號,也不能像下面那樣一次設定多個值:


# sysctl -w net.ipv4.ip_local_port_range="32768 61000"
net.ipv4.ip_local_port_range = 32768 61000

另外

sysctl使用 "/" 代替 "." 詳細資訊請看sysctl的manpage

提示:快速查找設定的資訊,可以聯合使用帶"-a"的grep.

11.2 /proc-filesystems 裡的數值類型.

11.3 Entries in /proc/sys/net/ipv6/

conf/default/*

Change the interface-specific default settings

conf/all/*

改變所有 interface-specific 設定.

除了: "conf/all/forwarding" 它有不同的含義.

conf/all/forwarding

在兩個界面之間進行global IPv6 forwarding (數據包轉寄.)

IPv6 當中您不能單獨控制一個設備的 forwarding (數據包轉寄). forwarding 的控制由IPv6-netfilter 完成. 當值為"0"時 數據包轉寄的能力被關閉,數據包不會離開各自的界面(包括物理/虛擬)比如 tunnel. 當值為"1"時 數據包轉寄的能力被開啟.

conf/interface/*

改變單個界面的設定. 依據local forwarding 是 enabled 或 not.

accept_ra

接受IPv6路由廣告.並且根據得到的信息自動設定.

accept_redirectsc

接受IPv6路由器的重定向.

autoconf

設定本地連結地址使用L2硬體地址. 它依據界面的L2-MAC address自動產生一個地址如:"fe80::201:23ff:fe45:6789"

dad_transmits

發送重複地址嗅探的總數.

forwarding

設定主機/路由的interface-specific動作.

注意:推薦所有interface(界面)使用相同的設定.混合路由器/主機的想法真是難得.

hop_limit

缺省hop限制.

mtu

缺省最大傳輸單元.

router_solicitation_delay

在發送路由請求之前界面的等待時間(秒).

router_solicitation_interval

在每個路由請求之間的等待時間(秒).

router_solicitations

假定沒有路由的情況下發送的請求個數.

neigh/default/*

Change default settings for neighbor detection and some special global interval and threshold values:

gc_thresh1

More to be filled.

gc_thresh2

More to be filled.

gc_thresh3

芳鄰列印表大小的調節項.

如果您有許多界面,或路由表現反常 試著增大數值. Or if a running Zebra (routing daemon) reports:


ZEBRA: netlink-listen error: No buffer space available, type=RTM_NEWROUTE(24), seq=426, pid=0

gc_interval

More to be filled.

neigh/interface/*

Change special settings per interface for neighbor detection.

anycast_delay

More to be filled.

gc_stale_time

More to be filled.

proxy_qlen

More to be filled.

unres_qlen

More to be filled.

app_solicit

More to be filled.

locktime

More to be filled.

retrans_time

More to be filled.

base_reachable_time

More to be filled.

mcast_solicit

More to be filled.

ucast_solicit

More to be filled.

delay_first_probe_time

More to be filled.

proxy_delay

More to be filled.

route/*

設定global(全局)路由

flush

Removed in newer kernel releases - more to be filled.

gc_interval

More to be filled.

gc_thresh

More to be filled.

mtu_expires

More to be filled.

gc_elasticity

More to be filled.

gc_min_interval

More to be filled.

gc_timeout

More to be filled.

min_adv_mss

More to be filled.

max_size

More to be filled.

11.4 IPv6-related entries in /proc/sys/net/ipv4/

目前(直到IPv4全部成為核心模組),一些開關也可以為IPv6所使用.

ip_*

ip_local_port_range

也可以為IPv6使用.

tcp_*

也可以為IPv6使用.

ICMP_*

不能為IPv6使用. 激活 ICMPv6 比率限制 rate limting (極力推薦,因為它有抵禦 ICMPv6 網路風暴的能力) netfilter-v6 rules must be used.

其它

不知道, 不能為IPv6使用吧.

11.5 IPv6-related entries in /proc/net/

這個地方是只讀的, 您不能通過 "sysctl" 得到資訊,可以使用 "cat"

if_inet6

每一行地址包含多個值.

這裡IPv6地址是用特殊的格式列印的,例子只列印環繞interface(界面)含義在下面


# cat /proc/net/if_inet6
00000000000000000000000000000001 01 80 10 80 lo
+------------------------------+ ++ ++ ++ ++ ++
|                                |  |  |  |  |
1                                2  3  4  5  6

1. 地址用32個不包含":"的十六進制列印.

2. 連結的設備數值(interface index)使用十六進制列印.

3. 前綴的長度使用十六進制列印.

4. Scope value (see kernel source " include/net/ipv6.h" and "net/ipv6/addrconf.c" for more)

5. Interface flags (see "include/linux/rtnetlink.h" and "net/ipv6/addrconf.c" for more)

6. 設備名.

ipv6_route

每一行地址包含多個值.

這裡IPv6地址是用特殊的格式列印的,例子只列印環繞interface(界面)含義在下面


# cat /proc/net/ipv6_route
00000000000000000000000000000000 00 00000000000000000000000000000000 00
+------------------------------+ ++ +------------------------------+ ++
|                                |  |                                |
1                                2  3                                4
? 00000000000000000000000000000000 ffffffff 00000001 00000001 00200200 lo
? +------------------------------+ +------+ +------+ +------+ +------+ ++
? |                                |        |        |        |        |
? 5                                6        7        8        9        10

1. IPv6目標網路用32個不包含":"的十六進制列印.

2. IPv6prefix(前綴)的長度使用十六進制列印.

3. IPv6來源網路用32個不包含":"的十六進制列印.

4. IPv6來源prefix(前綴)的長度使用十六進制列印.

5. IPv6下一個hop(躍點)用32個不包含":"的十六進制列印.

6. Metric in hexadecimal

7. Reference counter

8. Use counter

9. Flags(標緻)

10.Device name

sockstat6

每一行地址包含多個值.

IPv6 sockets統計:


# cat /proc/net/sockstat6
TCP6: inuse 7 
UDP6: inuse 2 
RAW6: inuse 1 
FRAG6: inuse 0 memory 0


 tcp6
To be filled.

 udp6
To be filled.

 igmp6
To be filled.

 raw6
To be filled.

 ip6_flowlabel
To be filled.

 rt6_stats
To be filled.

 snmp6

Type: One line per SNMP description and value

SNMP statistics, can be retrieved via SNMP server and related MIB table by network management software.

 ip6_tables_names
Available netfilter6 tables


Next Previous Contents