Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not related to this repository, but how to create a new network interface like enps0. #336

Open
aadarshkt opened this issue Nov 26, 2024 · 0 comments

Comments

@aadarshkt
Copy link

aadarshkt commented Nov 26, 2024

In general I am following this article, Link to mergeBoard to create a QEMU microVM with Docker.

Ethernet interface is edited through init file, but I don't know how to create another interface for the microVM.

#!/bin/bash -xe

# Preparations for filesystem and process information
mount -t proc proc /proc
mount -t sysfs sysfs /sys

mkdir -p /dev
test -c /dev/null || mknod -m 666 /dev/null c 1 3
test -c /dev/zero || mknod -m 666 /dev/zero c 1 5
test -c /dev/ptmx || mknod -m 666 /dev/ptmx c 5 2
test -c /dev/tty || mknod -m 666 /dev/tty c 5 0
test -c /dev/random || mknod -m 444 /dev/random c 1 8

mkdir -p /dev/pts /dev/shm
mount -vt devpts -o gid=4,mode=620 none /dev/pts
mount -vt tmpfs none /dev/shm
mount devpts /dev/pts -t devpts

# update library search dirs
ldconfig

# set Environment Variables
export $(cat /.env | xargs -d "\r")
env

# set hostname
hostname $HOSTNAME
hostname

# set date
date -s "2024-01-01 00:00:00"
date

# Configure loopback device
ip link set lo up

# Configure IP for eth0 that is connected to VEOS Ethernet bus
ip addr add 192.168.1.2/24 dev eth0 || echo "ERROR: Could not set IP to eth0"
ip link set eth0 up || echo "ERROR: Could not bring eth0 up"

# Configure IP for eth1 that is connected to ds_veos_tap device of simulation host
#ip addr add 192.168.1.10/24 dev eth1 || echo "ERROR: Could not set IP to eth1"
#ip link set eth1 up || echo "ERROR: Could not bring eth1 up"

ip addr show

netstat -a

# X11 configuration
touch /root/.Xauthority
sed -i 's/#X11UseLocalhost yes/X11UseLocalhost no/g' /etc/ssh/sshd_config

# remove /etc/password.lock
rm -f /etc/passwd.lock

# user configuration for ssh login
echo "user:user" | chpasswd
usermod --shell /bin/bash user


# start sshd
mkdir -p /run/sshd
/usr/sbin/sshd

echo "DONE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant