«

pve 网络配置

学长 发布于 阅读:1080 NAS


结论无法做到直接让wifi像windwos中的vmware那样做网桥

只能通过iptable做nat

因为是在家用环境虽然wifi能用了

但是因为大多数设备根本不可能进入 vmbr0的网段。。。

所以折腾



扫描

iwlist wlp2s0 scanning|grep -i 'ssid\|ieee\|freq\|quality'



DHCP 中继

apt install isc-dhcp-relay


Debian10开启路由转发以及配置dhcp中继_debian路由转发_小吴在敲Bug的博客-CSDN博客

直接中继没卵用。。。

跨网段自动分配IP地址的方法 - 知乎 (zhihu.com)

中看到要开启DHCP。。。

要不先按下DHCP

利用PVE给独立服务器自动获取ip开通NAT IPV4+DHCP IPV6+独立ipv4 - 主机评测 (zjpc.cc)


apt install isc-dhcp-server


仔细看了下都是在原有的DHCP服务上然后再对其转发

wifi到网桥本来二层就没法实现。。。

普通模式,桥不过去

brctl addif  vmbr2 wlp2s0
can't add vmbr2 to bridge wlp2s0: Operation not supported

或许还是得试试hostapd,毕竟hostapd是能实现wifi到wifi的桥接的

也许能找到AP模式的方法




Job for isc-dhcp-server.service failed because the control process exited with error code.
See "systemctl status isc-dhcp-server.service" and "journalctl -xeu isc-dhcp-server.service" for details.
invoke-rc.d: initscript isc-dhcp-server, action "restart" failed.
× isc-dhcp-server.service - LSB: DHCP server
     Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
     Active: failed (Result: exit-code) since Wed 2023-10-04 23:15:12 CST; 78ms ago
       Docs: man:systemd-sysv-generator(8)
    Process: 2550 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)
        CPU: 186ms

Oct 04 23:15:10 UX64T dhcpd[2562]: bugs on either our web page at www.isc.org or in the README file
Oct 04 23:15:10 UX64T dhcpd[2562]: before submitting a bug.  These pages explain the proper
Oct 04 23:15:10 UX64T dhcpd[2562]: process and the information we find helpful for debugging.
Oct 04 23:15:10 UX64T dhcpd[2562]: 
Oct 04 23:15:10 UX64T dhcpd[2562]: exiting.
Oct 04 23:15:12 UX64T isc-dhcp-server[2550]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ... failed!
Oct 04 23:15:12 UX64T isc-dhcp-server[2550]:  failed!
Oct 04 23:15:12 UX64T systemd[1]: isc-dhcp-server.service: Control process exited, code=exited, status=1/FAILURE
Oct 04 23:15:12 UX64T systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Oct 04 23:15:12 UX64T systemd[1]: Failed to start isc-dhcp-server.service - LSB: DHCP server.
Processing triggers for man-db (2.11.2-2) ...


出错。。。

journalctl -ex


journalctl _PID=2550 

journalctl _PID=2562

Oct 04 23:15:10 UX64T dhcpd[2562]: Wrote 0 leases to leases file.
Oct 04 23:15:10 UX64T dhcpd[2562]: 
Oct 04 23:15:10 UX64T dhcpd[2562]: No subnet declaration for vmbr0 (10.233.60.1).
Oct 04 23:15:10 UX64T dhcpd[2562]: ** Ignoring requests on vmbr0.  If this is not what
Oct 04 23:15:10 UX64T dhcpd[2562]:    you want, please write a subnet declaration
Oct 04 23:15:10 UX64T dhcpd[2562]:    in your dhcpd.conf file for the network segment
Oct 04 23:15:10 UX64T dhcpd[2562]:    to which interface vmbr0 is attached. **
Oct 04 23:15:10 UX64T dhcpd[2562]: 
Oct 04 23:15:10 UX64T dhcpd[2562]: 
Oct 04 23:15:10 UX64T dhcpd[2562]: Not configured to listen on any interfaces!
Oct 04 23:15:10 UX64T dhcpd[2562]: 
Oct 04 23:15:10 UX64T dhcpd[2562]: If you think you have received this message due to a bug rather
Oct 04 23:15:10 UX64T dhcpd[2562]: than a configuration issue please read the section on submitting
Oct 04 23:15:10 UX64T dhcpd[2562]: bugs on either our web page at www.isc.org or in the README file
Oct 04 23:15:10 UX64T dhcpd[2562]: before submitting a bug.  These pages explain the proper
Oct 04 23:15:10 UX64T dhcpd[2562]: process and the information we find helpful for debugging.
Oct 04 23:15:10 UX64T dhcpd[2562]: 
Oct 04 23:15:10 UX64T dhcpd[2562]: exiting.

嗯。。。就是没设置

vi /etc/default/isc-dhcp-server

设置好要启动的网卡


sshd 因为没有证书出错

journalctl _PID=1018

Sep 27 15:12:27 UX64T pveproxy[1018]: /etc/pve/local/pve-ssl.key: failed to load local private key (key_file or key) at /usr/share/perl5/PVE/APIServer/AnyEvent.>

journalctl -xeu ssh.service

目前关闭了sshd服务

systemctl status ssh

systemctl disable ssh

ssh_config针对客户端设置

sshd_config针对服务器设置

此段在后续中有详细描述:https://iheld.net/?post=217



安装netwok manager


apt install network-manager

因为network manager的wifi管理更方便

systemctl enable NetworkManager.service

systemctl start NetworkManager.service

nmtui 图形

nmcli 指令

nmcli con show 查看nm可以管控的网卡

nmcli -p device 看下管控情况

Centos 7/8 网卡启动不起来


中说了管控不到结果直接跳过Network Manager去配网络

在ifcfg中设置

NM_CONTROLLED=no

但是因为PVE是用ip interface不是用ifconfig的

只需要在interface中删除wifi网卡,我的是wlp2s0

不过我没删除用#备注上了,

多行备注也行怕出问题。。。
:<<!
备注内容
然后就可以去nmcli中启用了,有三个模式,client,ap,ad-hoc



简单的办法是

直接nmtui进Activate设置wifi


桥接。。。目前做不到。。。大家都讲IEEE802.11协议上就不支持

即使用nm桥接到也没法在虚拟机中直接添加硬件。。。

但是VMware windwos版本毫无疑问是可以的


https://askubuntu.com/questions/319838/failed-to-set-interface-wlan0-into-ap-mode-intel-centrino-n1000-wireless

https://www.cyberciti.biz/faq/how-to-add-network-bridge-with-nmcli-networkmanager-on-linux/


AP模式设置

得先down

ifdown wlp2s0

但是因为我装了nm

ifconfig wlp2s0 down

默认的是客户端模式也就是managed模式

iw wlp2s0 set type managed

我们想换成ap模式也就是master模式。。。果然推荐用hostapd

iw wlp2s0 set type ap



查看设备

iw dev

lspci -k | grep -A 3 -i "network"

modinfo mt7921e


参考

双网卡问题:

Linux配置双网卡 - 知乎 (zhihu.com)

linux自动切换网,Linux使用shell自动切换网关-CSDN博客

Linux系统多网卡环境下的路由配置 | varlemon (cnblogs.com)

wifi桥接问题

PVE 使用 WiFi - 掘金 (juejin.cn)

WiFi 桥接功能 — 基于Linux路由器_linux wifi网口网桥合并-CSDN博客

wifi做AP

[How To]在Linux下设置无线网络桥接_can't add wlan0 to bridge br0: operation not suppo-CSDN博客

PVE 网络瞎折腾 | WRY (jingtao.fun)

多但是没什么用的汇总

【NAS】PVE的简单使用教程、调优、常见问题汇总 - 知乎 (zhihu.com)




扫描二维码,在手机上阅读