Setting up a network inside a chroot

Posted: 24/02/2012 in Shell tips
Tags: ,

This is a simple tutorial on how to get internet access in a chroot environment.

The requirements are:
Your chroot will be running under a main OS, which is already connected to the internet.
You already have mounted the disk to chroot to.

# mount -o bind /sys /media/chrooted_disk/sys
# mount -o bind /proc /media/chrooted_disk/proc
# chroot /media/chrooted_disk

You need to reset the network in order for the route/dns stuff to be setup.

# dhclient eth0
or
# dhcpcd

Have fun 😉

Advertisements
Comments
  1. zod says:

    thx 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s