イーサネットと同じサブネットにVLANを設定するにはどうすればよいですか?

イーサネットと同じサブネットにVLANを設定するにはどうすればよいですか?

物理ネットワークカードがあり、開発名はeth0、IPは192.168.1.2、ゲートウェイは192.168.1.1です。 VLANを設定したいです。 IPは192.168.1.xで、ゲートウェイはです。 eth0 と同じです。

VLAN設定はスムーズに行われ、VLANにiface名eth0.10とIP 192.168.1.69を指定しました。接続を確立しようとするとエラーが発生します。

holmen@filserver:~$ sudo ifup eth0.10
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
RTNETLINK answers: File exists
Failed to bring up eth0.10.

それでは、VLANをインターネットに接続するにはどうすればいいですか?エラーメッセージはどういう意味ですか?放送と関係があるようです。

設定:/etc/ネットワーク/インターフェース

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
        address 192.168.1.2
        netmask 255.255.255.0
        network 192.168.1.0
        gateway 192.168.1.1

iface eth0.10 inet static
        address 192.168.1.69
        netmask 255.255.255.0
        gateway 192.168.1.1

起動時に自動eth0.10を設定したくないので、自動eth0.10を削除しました。

設定:設定されている場合

holmen@filserver:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1a:4d:5b:02:5c
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:4dff:fe5b:25c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11670807 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22363842 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:833725090 (833.7 MB)  TX bytes:31876321312 (31.8 GB)
          Interrupt:44 Base address:0x4000

eth0.10   Link encap:Ethernet  HWaddr 00:1a:4d:5b:02:5c
          inet addr:192.168.1.69  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:4dff:fe5b:25c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:432 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:41501 (41.5 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4899 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4899 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:697405 (697.4 KB)  TX bytes:697405 (697.4 KB)

設定:ネットワーク統計出力

holmen@filserver:~$ netstat -anr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0.10

テスト:ping出力ドメイン名

holmen@filserver:~$ ping -I eth0.10 www.dn.se
PING a1910.g1.akamai.net (23.60.69.161) from 192.168.1.2 eth0.10: 56(84) bytes of data.
From filserver.local (192.168.1.69) icmp_seq=1 Destination Host Unreachable
From filserver.local (192.168.1.69) icmp_seq=2 Destination Host Unreachable
From filserver.local (192.168.1.69) icmp_seq=3 Destination Host Unreachable
^C
--- a1910.g1.akamai.net ping statistics ---
5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4025ms
pipe 3

テスト:ping出力IPアドレス

holmen@filserver:~$ ping -I eth0.10 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 192.168.1.2 eth0.10: 56(84) bytes of data.
From 192.168.1.69 icmp_seq=1 Destination Host Unreachable
From 192.168.1.69 icmp_seq=2 Destination Host Unreachable
From 192.168.1.69 icmp_seq=3 Destination Host Unreachable
^C
--- 8.8.8.8 ping statistics ---
5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4023ms
pipe 3

ベストアンサー1

異なるインターフェイスで重複するサブネットを設定したいようです。これにより、ルーティングテーブルが破損し、多くのことが機能しなくなります。次に、まだ設定でVLANを設定していないため、eth0.10これを参照するといくつかの前提条件ステップがありません。 VLANが必要な場合(そうではないようです)、次を参照してください。VLANを正しく設定する方法を学ぶDebian Wiki

ネットワークスタックの場合、レイヤ1以上ではVLANインターフェイスが物理インターフェイスである可能性があるため、これを物理インターフェイスとして扱う必要があります。

インターフェイスでサブネットが重複する追加のIPが必要な場合は、それをセカンダリ(エイリアス)IPに設定する必要があります。eth0.10そのときに変更してくださいeth0:10/etc/interfacesifup eth0:10

おすすめ記事