Skip to content

Commit c0e8b7a

Browse files
Update README.md
1 parent 2c1d5a4 commit c0e8b7a

File tree

1 file changed

+47
-4
lines changed

1 file changed

+47
-4
lines changed

README.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ RED Hat Linux:
147147

148148
Linux 實做了 802.1Q tagged VLAN 功能,Vlan 就是將乙太網路進行虛擬切割的功能,實體的乙太網路可以透過 VLAN ID 切成許多的虛擬網路。 VLAN 環境下,具備相同的 VLAN ID 的機器才能彼此通訊,即便 LAN 線路接到同一個 hub 或 sw 上,只要 VLAN ID 不同就無法通訊。
149149

150-
* 使用命令列(指令)作設定
150+
# 使用命令列(指令)作設定
151151

152152
使用 vconfig 指令與 ip 指令。
153153

@@ -174,10 +174,53 @@ Linux 實做了 802.1Q tagged VLAN 功能,Vlan 就是將乙太網路進行虛
174174
175175
# ip link add link eth0 name eth0.100 type vlan id 100
176176
177-
這是以 NIC 網卡(又稱網路孔洞)eth0 建立 Vlan ID 100 的 Vlan 介面,與一般網路介面一樣,可設定 IP 位置。
178-
177+
//
178+
179+
180+
這是以 NIC 網卡(又稱網路孔洞)eth0 建立 Vlan ID 100 的 Vlan 介面,與一般網路介面一樣,可設定 IP 位置。
181+
182+
//
183+
184+
# ifconfig eth0.100 192.168.1.100
185+
# ifconfig eth0.100
186+
187+
eth0.100 Link encap: Ethernet HWaddr (略)
188+
inet addr: 192.168.1.100 Bcast: 192.168.1.255 Mask:255.255.255.0
189+
UP Bcast Running Multicast MTU:1500 Metric:1
190+
191+
//
192+
193+
194+
195+
建立 Vlan 介面狀態可以透過 /proc/net/vlan 確認。
196+
197+
//
198+
199+
# ls /proc/net/vlan/
200+
config eth0.100
201+
202+
# head /proc/net/vlan/*
203+
==> /proc/net/vlan/config <==
204+
205+
Vlan Dev name | Vlan ID
206+
Name-Type: Vlan_name_type_Raw_plus_vid_no_pad
207+
eth0.100 | 100 | eth0
208+
209+
210+
//
211+
212+
213+
214+
刪除 vlan 介面,可以透過指令 rem 和 delete 完成。
215+
216+
//
217+
218+
# vconfig rem eth0.100 || # ip link delete eth0.100
219+
220+
179221

180-
* 使用設定檔作設定
222+
# 使用設定檔作設定
223+
181224

182225
在 /etc/sysconfig/network-scripts/ 準備 eth0.100 用的設定檔案,可以在系統啟動時自動建立Vlan 介面。
183226

0 commit comments

Comments
 (0)