Use front USB connector as Ethernet service port with DHCP February 20, 2023 12:33PM |
Registered: 7 years ago Posts: 181 |
$ dmesg | tail -4
[498079.883797] asix 1-1:1.0 (unnamed net_device) (uninitialized): PHY [usb-001:005:10] driver [Asix Electronics AX88772A] (irq=POLL)
[498079.898637] Asix Electronics AX88772A usb-001:005:10: attached PHY driver (mii_bus:phy_addr=usb-001:005:10, irq=POLL)
[498079.911504] asix 1-1:1.0 eth2: register 'asix' at usb-d0050000.usb-1, ASIX AX88772 USB 2.0 Ethernet, 01:23:45:67:89:ab
[498079.955400] asix 1-1:1.0 enx0123456789ab: renamed from eth2
$ sudo cp -a /etc/network/interfaces /etc/network/interfaces.orig
$ sudo nano /etc/network/interfaces
$ tail -5 /etc/network/interfaces
rename /enx*=usb0
allow-hotplug usb0
iface usb0 inet static
address 192.168.100.100/24
gateway 192.168.1.1
The kernel's proposed name for the interface ('enx0123456789ab') must match the pattern ('enx*') for renaming it to 'usb0' to work. The slash ('/') just before 'enx*' is not part of the pattern.
$ sudo ifconfig [...] usb0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.100.100 netmask 255.255.255.0 broadcast 192.168.100.255 ether 01:23:45:67:89:ab txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0Unplug the adapter.
$ sudo apt install -y isc-dhcp-server [...] Generating /etc/default/isc-dhcp-server... Launching both IPv4 and IPv6 servers (please configure INTERFACES in /etc/default/isc-dhcp-server if you only want one or the other). Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ... failed! failed! invoke-rc.d: initscript isc-dhcp-server, action "start" failed. [...]
$ sudo cp -a /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.orig $ sudo nano /etc/dhcp/dhcpd.conf $ diff /etc/dhcp/dhcpd.conf.orig /etc/dhcp/dhcpd.conf 7,8c7,8 < option domain-name "example.org"; < option domain-name-servers ns1.example.org, ns2.example.org; --- > option domain-name "local"; > option domain-name-servers 192.168.1.1; 107a108,112 > > subnet 192.168.100.0 netmask 255.255.255.0 { > range 192.168.100.10 192.168.100.99; > option routers 198.192.1.1; > }
$ sudo cp -a /etc/default/isc-dhcp-server /etc/default/isc-dhcp-server.orig $ sudo nano /etc/default/isc-dhcp-server $ tail -4 /etc/default/isc-dhcp-server # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACESv4="usb0" INTERFACESv6=""
$ sudo nano /etc/udev/rules.d/85-ifupdown.rules $ cat /etc/udev/rules.d/85-ifupdown.rules # Handle allow-hotplug interfaces SUBSYSTEM=="net", ACTION=="add", RUN+="/etc/init.d/isc-dhcp-server restart" $ sudo udevadm control --reload-rules && sudo udevadm trigger
$ ifconfig | grep 'inet ' | grep 100 inet 192.168.100.10 netmask 255.255.255.0 broadcast 192.168.100.255
$ ping -c 1 192.168.100.100 PING 192.168.100.100 (192.168.100.100) 56(84) bytes of data. 64 bytes from 192.168.100.100: icmp_seq=1 ttl=64 time=0.735 ms --- 192.168.100.100 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.735/0.735/0.735/0.000 ms
$ ssh root@192.168.100.100 The authenticity of host '192.168.100.100 (192.168.100.100)' can't be established. ED25519 key fingerprint is SHA256:fQNAwY0Yy9NsXLyIUMQKByMp7oNOYF1C4O5kPE0iNrM. This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.100.100' (ED25519) to the list of known hosts. root@192.168.100.100's password:Reestablish the PC's wireless and/or cabled network again and repeat the verification.
$ logread | tail
$ sudo dmesg | tail
Re: Use front USB connector as Ethernet service port with DHCP February 20, 2023 03:46PM |
Admin Registered: 13 years ago Posts: 18,821 |
Re: Use front USB connector as Ethernet service port with DHCP February 20, 2023 07:30PM |
Registered: 7 years ago Posts: 181 |
Re: Use front USB connector as Ethernet service port with DHCP February 21, 2023 03:11PM |
Admin Registered: 13 years ago Posts: 18,821 |
Quote
Wifi - Access Point - USB Ethernet
Create an 802.11n AP (Access Point) with create_ap
Create an 802.11n AP (Access Point) (old style with manual steps)
Basic Wifi setup for Pogo V3 OXNAS and another example
Use front USB connector as Ethernet service port with DHCP
Re: Use front USB connector as Ethernet service port with DHCP March 18, 2023 02:23PM |
Registered: 7 years ago Posts: 181 |
Quote
One thing I'd question: is the name enx* always the pattern, or a different adapter will give you a different name pattern?
Re: Use front USB connector as Ethernet service port with DHCP March 18, 2023 02:44PM |
Admin Registered: 13 years ago Posts: 18,821 |
Re: Use front USB connector as Ethernet service port with DHCP March 20, 2023 08:49AM |
Registered: 9 years ago Posts: 1,037 |
Re: Use front USB connector as Ethernet service port with DHCP March 25, 2023 09:51AM |
Registered: 7 years ago Posts: 181 |
Quote
This is an awesome tip!!!
Re: Use front USB connector as Ethernet service port with DHCP March 25, 2023 12:39PM |
Admin Registered: 13 years ago Posts: 18,821 |
Re: Use front USB connector as Ethernet service port with DHCP March 25, 2023 10:34PM |
Registered: 9 years ago Posts: 451 |