sharing internet to chroot environment

www.abclinuxu.cz
chroot command is useful when we would like to enter an os that mounted into some directory without a real boot at it. For example, my os is damaged. I can’t boot into it. I use cd installation for helping me run the computer. I am talking slackware cd installation and slackware os.
after I got to the prompt, rather than I re-installed the os I just created a directory named sugi. Then I mounted /dev/sda1 (my slackware partition) to sugi
#mount /dev/sda1 sugi
It is time to use chroot
#chroot sugi
Now i am inside the slackware os. I might do something like re-write the boot manager (lilo.conf) into the MBR. Or in Ubuntu, we might updating the repository.
How about the internet connection when we need it?
Basically the internet is on. But we can not just use it. We need to edit /etc/resolv.conf with the dns in the host OS. For example I use opendns os 208.67.222.222
#nano /etc/resolv.conf
write
nameserver 208.67.222.222
ctrl+o to save the change
Test the connection with ping to somewhere like www.google.com.
The internet is now work.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.