[SOLVED] Need help figuring out how to run these commands on boot
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Need help figuring out how to run these commands on boot
Hi all,
I just started learning how to manipulate Linux (Debian Lenny) about a month ago with the intention of ditching Windows eventually and learning to configure servers in the process. But, I still need Windows for certain things. I downloaded and installed VirtualBox (I know, VMWare is better, but I didn't know that at the time and don't want to go through the process all over again) and got Windows XP working with a tap interface and bridge interface to get the guest OS to talk to the home OS and connect to the Internet. My only problem is that the tap interface and bridge interface disappear when I reboot and then I have to issue the commands to set them up all over again. I know there is a way to write a script to run on boot to create them and bring them up, but my whole technical career has been with CLI-based stuff, not scripting. I'd like to eventually learn it, but I'm a learn-by-doing type. Basically I need the following commands to be implemented at startup:
I read somewhere that you can just add commands to your /etc/init.d/bootmisc.sh file in Debian, but I don't want to hose up my whole system somehow.
If someone could help me with this and tell me what the basic parts of the script accomplish (I'd like to learn this stuff, not just have people constantly do this for me b/c I don't know how), it would be greatly appreciated.
Isn't /etc/rc.local only present in RedHat, Fedora, etc?
Nevermind, I found it, but where do I put the commands? Right now, it looks like this:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
Alternatively it could be done by writing the configuration in the /etc/network/interfaces file and letting the /etc/init.d/networking boot script do the work. Here is a sample interfaces file, taken from ubuntu 8.04 and used for VirtualBox before VirtualBox was enhanced to do it all itself. Change user c to allen and IP addresses as required
Code:
# eth0 is the physical interface.
# Bridging software will configure eth0 when it is added as a port to br0 (below)
# This minimal configuration avoids message "Ignoring unknown interface eth0=eth0"
auto eth0
iface eth0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
# tap0 is a tap into the bridge defined below
# * tap0 is for use by VirtualBox
# * Guest OS will configure, hence "manual"
# * VirtualBox will be run by user c, hence user c
# * "ifconfig" is part of ifupdown package
# * "tunctl_user" is part of tunctl package
auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user c
# br0 is a bridge connecting physical interface eth0 to OS and tap0
# * Stanzas for br0 ports must appear before the br0 stanza
# * Static configuration
# * No need for spanning tree protocol (stp) because no other bridges on network
iface br0 inet static
address 192.168.0.11
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.253
bridge_ports eth0 tap0
bridge_maxwait 0
bridge_stp off
Thanks AlucardZero and catkin for your help. I tried both methods and they worked. I've started looking into several shell scripting tutorials and stuff, so hopefully I can figure this stuff out on my own in the future. I'm not used to being a noob and it kinda bugs me. Thanks again!
I've started looking into several shell scripting tutorials and stuff, so hopefully I can figure this stuff out on my own in the future. I'm not used to being a noob and it kinda bugs me.
Glad you found a solution
Yes -- it's frustrating when you switch OS and go from being adept to having everything to learn. Although the specifics are different, many of the principles are the same so you are off to a head start compared with learning your first OS. Hope you enjoy the adventure
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.