USB NIC で VLAN 接続する
Windwos10 に
使用した NIC
Belkin USB-C to Gigabit Ethernet + USB-C 60W PD対応 有線LAN 変換アダプター INC001btBK-A
Vlan の設定に Diagnostic Program for Win7/Win8/Win10 をダウンロードしてインストールする。
ついでに、Driver も同じページからダウンロードできるのでアップデートしてみる。
ネットワークアドレス
Vlan | NetWork | Cisco2901 (Gi0/0) | PC (USB NIC) |
---|---|---|---|
10 | 10.0.10.0/24 | 10.0.10.1 | 10.0.10.10 |
20 | 10.0.20.0/24 | 10.0.20.1 | 10.0.20.10 |
30 | 10.0.30.0/24 | 10.0.30.1 | 10.0.30.10 |
40 | 10.0.40.0/24 | 10.0.40.1 | 10.0.40.10 |
50 | 10.0.50.0/24 | 10.0.50.1 | 10.0.50.10 |
VLAN を作る
デフォルトで有効だが、念のため VLAN が有効になっていることを確認する。
イーサネットのプロパティから「構成」を選択
開いたウィンドウで「詳細設定」タブを選択し、VLAN が有効になっていることを確認。
確認が終わったので、先ほどインストールした Diagnostic Utility をスタートメニューから起動。
対象の NIC の VLAN 欄を選択し VLAN を追加する。
順番に追加したのに、順番に並びませんねぇ。
インターフェイスの名前を変更
分かりにくいので、インターフェイスの名前を VLAN番号に変更する。
IP アドレスを設定
一つ一つ開いて設定するのは面倒なので PowerShell で設定する。
$ifs = @(
# New-NetIPAddress の引数を指定
# @{InterfaceAlias = "" ; IPAddress = "" ; PrefixLength = "" ; -DefaultGateway ""}
@{InterfaceAlias = "VLAN0010" ; IPAddress = "10.0.10.10" ; PrefixLength = "24"}
@{InterfaceAlias = "VLAN0020" ; IPAddress = "10.0.20.10" ; PrefixLength = "24"}
@{InterfaceAlias = "VLAN0030" ; IPAddress = "10.0.30.10" ; PrefixLength = "24"}
@{InterfaceAlias = "VLAN0040" ; IPAddress = "10.0.40.10" ; PrefixLength = "24"}
@{InterfaceAlias = "VLAN0050" ; IPAddress = "10.0.50.10" ; PrefixLength = "24"}
)
foreach ($if in $ifs){
# 設定前に削除が必要
Get-NetIPAddress -InterfaceAlias $if.InterfaceAlias | Remove-NetIPAddress -Confirm:$false > $null
# デフォルトルートが設定されていれば削除
Remove-NetRoute -InterfaceAlias $if.InterfaceAlias -DestinationPrefix 0.0.0.0/0 -Confirm:$false 2> $null
# アドレスを設定
New-NetIPAddress -AddressFamily IPv4 @if > $null
Get-NetIPAddress -InterfaceAlias $if.InterfaceAlias | Select-Object InterfaceAlias,IPAddress,PrefixLength
}
# Get-NetIPConfiguration |? InterfaceAlias -Match 'VLAN*' | Select-Object * | Out-GridView
InterfaceAlias IPAddress PrefixLength
-------------- --------- ------------
VLAN0010 10.0.10.10 24
VLAN0020 10.0.20.10 24
VLAN0030 10.0.30.10 24
VLAN0040 10.0.40.10 24
VLAN0050 10.0.50.10 24
Cisco 側のインターフェース設定
interface GigabitEthernet0/0
no ip address
no shutdown
duplex full
speed 1000
interface GigabitEthernet0/0.10
encapsulation dot1q 10
ip address 10.0.10.1 255.255.255.0
interface GigabitEthernet0/0.20
encapsulation dot1q 20
ip address 10.0.20.1 255.255.255.0
interface GigabitEthernet0/0.30
encapsulation dot1q 30
ip address 10.0.30.1 255.255.255.0
interface GigabitEthernet0/0.40
encapsulation dot1q 40
ip address 10.0.40.1 255.255.255.0
interface GigabitEthernet0/0.50
encapsulation dot1q 50
ip address 10.0.50.1 255.255.255.0
接続確認
Router#ping 10.0.10.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.10.10, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/4 ms
Router#ping 10.0.20.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.20.10, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/4 ms
Router#ping 10.0.30.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.30.10, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/4 ms
Router#ping 10.0.40.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.40.10, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/4 ms
Router#ping 10.0.50.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.50.10, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/4 ms
Router#
普通に繋がりますねぇ。
native vlan
vlan 7 を native vlan (タグなし) にする。
先ほどから vlan 7, 29 を追加。
Vlan | NetWork | Cisco2901 (Gi0/0) | PC (USB NIC) |
---|---|---|---|
7 | 10.0.7.0/24 | 10.0.7.1 | 10.0.7.10 |
10 | 10.0.10.0/24 | 10.0.10.1 | 10.0.10.10 |
20 | 10.0.20.0/24 | 10.0.20.1 | 10.0.20.10 |
29 | 10.0.29.0/24 | 10.0.29.1 | 10.0.29.10 |
30 | 10.0.30.0/24 | 10.0.30.1 | 10.0.30.10 |
40 | 10.0.40.0/24 | 10.0.40.1 | 10.0.40.10 |
50 | 10.0.50.0/24 | 10.0.50.1 | 10.0.50.10 |
Windows 側
vlan0029 を作成しアドレスを設定。(vlan7 は通常のインターフェイスに設定)
$ifs = @(
# New-NetIPAddress の引数を指定
# @{InterfaceAlias = "" ; IPAddress = "" ; PrefixLength = "" ; -DefaultGateway ""}
@{InterfaceAlias = "イーサネット" ; IPAddress = "10.0.7.10" ; PrefixLength = "24"}
@{InterfaceAlias = "VLAN0010" ; IPAddress = "10.0.10.10" ; PrefixLength = "24"}
@{InterfaceAlias = "VLAN0020" ; IPAddress = "10.0.20.10" ; PrefixLength = "24"}
@{InterfaceAlias = "VLAN0029" ; IPAddress = "10.0.29.10" ; PrefixLength = "24"}
@{InterfaceAlias = "VLAN0030" ; IPAddress = "10.0.30.10" ; PrefixLength = "24"}
@{InterfaceAlias = "VLAN0040" ; IPAddress = "10.0.40.10" ; PrefixLength = "24"}
@{InterfaceAlias = "VLAN0050" ; IPAddress = "10.0.50.10" ; PrefixLength = "24"}
)
foreach ($if in $ifs){
# 設定前に削除が必要
Get-NetIPAddress -InterfaceAlias $if.InterfaceAlias | Remove-NetIPAddress -Confirm:$false > $null
# デフォルトルートが設定されていれば削除
Remove-NetRoute -InterfaceAlias $if.InterfaceAlias -DestinationPrefix 0.0.0.0/0 -Confirm:$false 2> $null
# アドレスを設定
New-NetIPAddress -AddressFamily IPv4 @if > $null
Get-NetIPAddress -InterfaceAlias $if.InterfaceAlias | Select-Object InterfaceAlias,IPAddress,PrefixLength
}
# Get-NetIPConfiguration |? InterfaceAlias -Match 'VLAN*' | Select-Object * | Out-GridView
Cisco 側
interface GigabitEthernet0/0
no ip address
no shutdown
duplex full
speed 1000
interface GigabitEthernet0/0.7
encapsulation dot1q 7 native
ip address 10.0.7.1 255.255.255.0
interface GigabitEthernet0/0.10
encapsulation dot1q 10
ip address 10.0.10.1 255.255.255.0
interface GigabitEthernet0/0.20
encapsulation dot1q 20
ip address 10.0.20.1 255.255.255.0
interface GigabitEthernet0/0.29
encapsulation dot1q 29
ip address 10.0.29.1 255.255.255.0
interface GigabitEthernet0/0.30
encapsulation dot1q 30
ip address 10.0.30.1 255.255.255.0
interface GigabitEthernet0/0.40
encapsulation dot1q 40
ip address 10.0.40.1 255.255.255.0
interface GigabitEthernet0/0.50
encapsulation dot1q 50
ip address 10.0.50.1 255.255.255.0
うん、繋がりますね。