mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-19 04:56:30 +00:00
增加对dhcpv4的支持(tcp、udp socket已写好,但由于缺少epoll机制,尚未完整测试) (#237)
* 为virtio网卡完成smoltcp的phy层配置 * raw socket * 初步写完udp和tcp socket * 能够正常通过dhcp获取ipv4地址(具有全局iface btree) --------- Co-authored-by: guanjinquan <1666320330@qq.com>
This commit is contained in:
27
tools/configure_network.sh
Normal file
27
tools/configure_network.sh
Normal file
@ -0,0 +1,27 @@
|
||||
# Replace with your wired Ethernet interface name
|
||||
ETH=eno1
|
||||
|
||||
sudo modprobe bridge
|
||||
sudo modprobe br_netfilter
|
||||
|
||||
sudo sysctl -w net.bridge.bridge-nf-call-arptables=0
|
||||
sudo sysctl -w net.bridge.bridge-nf-call-ip6tables=0
|
||||
sudo sysctl -w net.bridge.bridge-nf-call-iptables=0
|
||||
|
||||
sudo ip tuntap add name tap0 mode tap user $USER
|
||||
sudo brctl addbr br0
|
||||
sudo brctl addif br0 tap0
|
||||
sudo brctl addif br0 $ETH
|
||||
sudo ip link set tap0 up
|
||||
sudo ip link set $ETH up
|
||||
sudo ip link set br0 up
|
||||
|
||||
|
||||
# This connects your host system to the internet, so you can use it
|
||||
# at the same time you run the examples.
|
||||
sudo dhcpcd br0
|
||||
|
||||
sudo mkdir -p /usr/local/etc/qemu
|
||||
sudo mkdir -p /etc/qemu
|
||||
sudo sh -c 'echo "allow br0" > /usr/local/etc/qemu/bridge.conf'
|
||||
sudo sh -c 'echo "allow br0" > /etc/qemu/bridge.conf'
|
@ -6,7 +6,7 @@ echo "$@"
|
||||
allflags=$(qemu-system-x86_64 -cpu help | awk '/flags/ {y=1; getline}; y {print}' | tr ' ' '\n' | grep -Ev "^$" | sed -r 's|^|+|' | tr '\n' ',' | sed -r "s|,$||")
|
||||
ARCH="x86_64"
|
||||
#ARCH="i386"
|
||||
# 请根据自己的需要,在-d 后方加入所需的trace事件
|
||||
# 请根据自己的需要,在-d 后方加入所需的 trace 事件
|
||||
|
||||
# 标准的trace events
|
||||
qemu_trace_std=cpu_reset,guest_errors,exec,cpu,trace:virtio*
|
||||
@ -29,7 +29,7 @@ QEMU_RTC_CLOCK="clock=host,base=localtime"
|
||||
QEMU_SERIAL="file:../serial_opt.txt"
|
||||
QEMU_DRIVE="id=disk,file=${QEMU_DISK_IMAGE},if=none"
|
||||
|
||||
QEMU_DEVICES="-device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 -nic user,model=virtio -usb -device qemu-xhci,id=xhci,p2=8,p3=4 -machine accel=${qemu_accel}"
|
||||
QEMU_DEVICES="-device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 -nic user,model=virtio-net-pci -usb -device qemu-xhci,id=xhci,p2=8,p3=4 -machine accel=${qemu_accel}"
|
||||
|
||||
QEMU_ARGUMENT="-d ${QEMU_DISK_IMAGE} -m ${QEMU_MEMORY} -smp ${QEMU_SMP} -boot order=d -monitor ${QEMU_MONITOR} -d ${qemu_trace_std} "
|
||||
|
||||
|
Reference in New Issue
Block a user