Sample Header Ad - 728x90

Network unreachable while tftp on a virtual machine. What config should I add?

0 votes
1 answer
1247 views
I'm trying to build a minimal kernel where tftp works. I'm using busybox for initramfs and I'll be running the kernel on an arm64 virtual machine. The command for getting file is tftp -g -r axpu_ldd_kc.ko my_ip_addr(of course my tftp server is working). But the response is : tftp: sendto: Network is unreachable So I added some network stuff in the kernel configuration (linux-5.10.0-rc5) but still doesn't work. I can't figure out what more to add just to make tftp work Could anyone tell me what is missing from the defconfig below? (using e1000 in qemu virtual machine). (As you can see, I added CONFIG_NF_CONNTRACK_TFTP for which the menuconfig says it's TFTP support. And the .config file has CONFIG_NF_NAT_TFTP set to =y. I show the defconfig because .config is too long) # CONFIG_SWAP is not set # CONFIG_CROSS_MEMORY_ATTACH is not set CONFIG_PREEMPT=y # CONFIG_CPU_ISOLATION is not set CONFIG_LOG_BUF_SHIFT=12 CONFIG_LOG_CPU_MAX_BUF_SHIFT=10 CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=10 CONFIG_USER_NS=y CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE="../../../../ab21sim/ab21tsim/busybox-1.32.1/initramfs.cpio.gz" # CONFIG_RD_BZIP2 is not set # CONFIG_RD_LZMA is not set # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set # CONFIG_RD_LZ4 is not set # CONFIG_RD_ZSTD is not set CONFIG_PERF_EVENTS=y CONFIG_SLAB=y CONFIG_NR_CPUS=2 # CONFIG_RODATA_FULL_DEFAULT_ENABLED is not set # CONFIG_ARM64_TAGGED_ADDR_ABI is not set # CONFIG_ARM64_UAO is not set # CONFIG_ARM64_RAS_EXTN is not set # CONFIG_ARM64_CNP is not set # CONFIG_ARM64_PTR_AUTH is not set # CONFIG_ARM64_AMU_EXTN is not set # CONFIG_ARM64_TLB_RANGE is not set # CONFIG_ARM64_BTI is not set # CONFIG_ARM64_E0PD is not set # CONFIG_ARCH_RANDOM is not set # CONFIG_ARM64_SVE is not set # CONFIG_EFI is not set # CONFIG_SECCOMP is not set # CONFIG_BLK_DEV_BSG is not set # CONFIG_MQ_IOSCHED_DEADLINE is not set # CONFIG_MQ_IOSCHED_KYBER is not set CONFIG_BINFMT_MISC=y CONFIG_FLATMEM_MANUAL=y # CONFIG_COMPACTION is not set CONFIG_NET=y CONFIG_INET=y CONFIG_NETFILTER=y CONFIG_NF_CONNTRACK=y CONFIG_NF_CONNTRACK_TFTP=y CONFIG_NF_NAT=y CONFIG_DEVTMPFS=y CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=1 CONFIG_BLK_DEV_RAM_SIZE=65536 CONFIG_NETDEVICES=y # CONFIG_KEYBOARD_ATKBD is not set # CONFIG_INPUT_MOUSE is not set CONFIG_SERIO_LIBPS2=y CONFIG_VT_HW_CONSOLE_BINDING=y # CONFIG_LEGACY_PTYS is not set CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y # CONFIG_HWMON is not set # CONFIG_USB_SUPPORT is not set CONFIG_RTC_CLASS=y # CONFIG_RTC_HCTOSYS is not set # CONFIG_RTC_INTF_SYSFS is not set # CONFIG_RTC_INTF_PROC is not set # CONFIG_RTC_INTF_DEV is not set CONFIG_RTC_DRV_M48T59=y # CONFIG_VHOST_MENU is not set # CONFIG_IOMMU_SUPPORT is not set # CONFIG_NVMEM_SYSFS is not set CONFIG_EXT2_FS=y CONFIG_EXT2_FS_XATTR=y CONFIG_EXT2_FS_POSIX_ACL=y CONFIG_EXT2_FS_SECURITY=y # CONFIG_DNOTIFY is not set # CONFIG_INOTIFY_USER is not set CONFIG_AUTOFS4_FS=y CONFIG_ISO9660_FS=y CONFIG_PROC_KCORE=y # CONFIG_MISC_FILESYSTEMS is not set CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity" CONFIG_DEBUG_INFO=y CONFIG_FRAME_WARN=1024 CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_KERNEL=y CONFIG_DETECT_HUNG_TASK=y # CONFIG_SCHED_DEBUG is not set # CONFIG_RCU_TRACE is not set By the way, the qemu command is this : > /home/ckim/ProjX/QEMU/qemu-6.2.0/build-baremetal/aarch64-softmmu/qemu-system-aarch64 > -machine ab21q,gic-version=max,secure=off,virtualization=true -cpu max -kernel /home/ckim/ProjX/LinuxDevDrv/kernel-release-RD-INFRA-2020.11.30/arch/arm64/boot/Image > -m 2048M -nographic -netdev user,id=net0,tftp=/opt/tftp -device e1000,netdev=net0 -machine iommu=smmuv3 --append "root=/dev/ram > init=/init nokaslr earlycon ip=dhcp hugepages=16" And by the -netdev and -device e1000 options, the user mode network backend is implemented in the qemu that makes us communicate with outside world. The virtual machine has the IP address 10.0.2.15. I've used this user networking mode many times before. (with full kernel default configuration, this tftp runs ok. but I wanted to reduce the kernel Image size from almost 36MB to about 6MB for fast running the test). Please see qemu network modes here : https://wiki.qemu.org/Documentation/Networking ADD : (as requested by dirkt) I have DHCP server inside the VM (see above Networking document), my VM has static IP address. and my host too. I believe DHCP client on VM works and DHCP server runs by the qemu program (so qemu program makes the network environment for the VM). I can login to the VM and I can do debug. (but I'm doing other task today). Here is the ip addr command response. / # tftp -g -r axpu_ldd_kc.ko 129.254.32.30 tftp: sendto: Network is unreachable / # ip addr 1: lo: mtu 65536 qdisc noop qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: sit0@NONE: mtu 1480 qdisc noop qlen 1000 link/sit 0.0.0.0 brd 0.0.0.0 ADD2 : (for dirkt's comment) I added PCI and PCIE and e1000 (Intel Etheret card) hoping this could be it. But it was not. Below is the result in the shell. ifconfig: SIOCSIFADDR: No such device route: SIOCADDRT: Network is unreachable /bin/sh: can't access tty; job control turned off / # tftp -g -r axpu_ldd_kc.ko 129.254.32.30 tftp: sendto: Network is unreachable
Asked by Chan Kim (459 rep)
Mar 24, 2022, 10:42 PM
Last activity: Sep 10, 2024, 09:45 AM