여러 인터페이스를 갖춘 Ubuntu 22.04 공유 인터넷 연결

여러 인터페이스를 갖춘 Ubuntu 22.04 공유 인터넷 연결

나는 사용한다계피가 포함된 Lubuntu 22.04 LTS정확히 말하면 데스크탑.

내 마더보드에는 단일 인터페이스가 있는 네트워크 장치가 하나 있습니다.

enp5s0내 ISP 라우터에 연결되어 있고 고정되어 있습니다.IP 192.168.1.19/24.

인터페이스가 4개 있는 또 다른 네트워크 장치가 있습니다.

여기에 이미지 설명을 입력하세요

이 두 번째 네트워크 장치를 라우터로 사용하고 싶습니다. 어떻게 진행해야 하나요?

지금은 방법을 변경하고 IP를 편집하여 하나의 인터페이스에만 공유할 수 있습니다.

공유 enp7s4f0 인터페이스

답변1

netboot 서버 설정을 찾아 솔루션을 찾았습니다.

  1. enp7f4s0을 사용하여 두 번째 장치에서 mach까지 모든 단일 인터페이스를 편집했습니다.(IP도 동일). 인터페이스_IP_구성
  2. dnsmasq를 설치했습니다.

sudo apt install dnsmasq

  1. 제안한 대로 구성 파일을 만들었습니다.netboot에 대한 Ubuntu.com구성.

touch /etc/dnsmasq.d/pxe.conf

  1. 나는 편집했다pxe.conf파일은 다음과 같습니다:

    interface=enp5s0,lo

    bind-interfaces

    dhcp-range=enp7s4f0,192.168.2.2,192.168.2.10

    dhcp-range=enp7s4f1,192.168.2.11,192.168.2.20

    dhcp-range=enp8s6f0,192.168.2.21,192.168.2.30

    dhcp-range=enp8s6f1,192.168.2.31,192.168.2.40

    dhcp-boot=pxelinux.0

    dhcp-match=set:efi-x86_64,option:client-arch,7

    dhcp-boot=tag:efi-x86_64,bootx64.efi

    enable-tftp

    tftp-root=/srv/tftp

이제 두 번째 이더넷 장치의 모든 인터페이스에서 인터넷 연결이 공유됩니다.

● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
     Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-06-18 07:19:38 CEST; 35min ago
   Main PID: 3458 (dnsmasq)
      Tasks: 1 (limit: 18871)
     Memory: 656.0K
        CPU: 19ms
     CGroup: /system.slice/dnsmasq.service
             └─3458 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service --trust-anchor=.,20326,8,2,e06d44b80b8f1d39a95c0b0d7c65d08458e880409>

Jun 18 07:19:38 lubuton dnsmasq-dhcp[3458]: DHCP, IP range 192.168.2.31 -- 192.168.2.40, lease time 1h
Jun 18 07:19:38 lubuton dnsmasq-dhcp[3458]: DHCP, IP range 192.168.2.21 -- 192.168.2.30, lease time 1h
Jun 18 07:19:38 lubuton dnsmasq-dhcp[3458]: DHCP, IP range 192.168.2.11 -- 192.168.2.20, lease time 1h
Jun 18 07:19:38 lubuton dnsmasq-dhcp[3458]: DHCP, IP range 192.168.2.2 -- 192.168.2.10, lease time 1h
Jun 18 07:19:38 lubuton dnsmasq-dhcp[3458]: DHCP, sockets bound exclusively to interface enp5s0
Jun 18 07:19:38 lubuton dnsmasq-tftp[3458]: TFTP root is /srv/tftp
Jun 18 07:19:38 lubuton dnsmasq[3458]: reading /etc/resolv.conf
Jun 18 07:19:38 lubuton dnsmasq[3458]: using nameserver 127.0.0.53#53
Jun 18 07:19:38 lubuton dnsmasq[3458]: read /etc/hosts - 5 addresses
Jun 18 07:19:38 lubuton systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server. 

dnsmasq 구성에 대한 마지막 변경 사항도 작동했습니다.

interface=enp5s0,lo
bind-interfaces
log-dhcp
dhcp-host=pxe.home.lan,192.168.2.1
dhcp-range=192.168.2.2,192.168.2.40
enable-tftp
tftp-root=/srv/tftp

관련 정보