이더넷과 동일한 서브넷에 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

시험:핑 출력 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을 올바르게 설정하는 방법을 배우는 데비안 위키.

네트워크 스택의 경우 레이어 1 이상에서는 VLAN 인터페이스가 물리적 인터페이스일 수도 있으므로 이를 물리적 인터페이스로 처리해야 합니다.

인터페이스에서 서브넷이 겹치는 추가 IP를 원하는 경우 이를 보조(별칭) IP로 설정해야 합니다. eth0.10그때 로 변경하세요 .eth0:10/etc/interfacesifup eth0:10

답변2

RTNETLINK answers: File exists별로 도움이 되지 않을 수도 있지만, VPN Labs에서 일하면서 같은 상황에 직면했습니다.

마지막으로 클라이언트를 실행했을 때부터 라우팅 테이블에 여전히 일부 오래된 항목이 있었지만 이더넷 어댑터는 제거한 것으로 나타났습니다. 다시 추가하면 RTNETLINK answers: File exists해당 이더넷 어댑터를 사용하여 라우팅 테이블에서 이전 항목을 삭제할 때까지 해당 항목이 표시됩니다. 이것이 의도적으로 설계된 것인지는 모르겠지만 Ubuntu 11.04 Natty Narwhal VM에서 발견한 내용입니다.

관련 정보