automating commands in linux on start up

Everytime my linux boots i have to run the following commands :
dhclient -- to connect it to the internet
service firewalls stop --- so that outside system could connect to it..

How can i automate this so that when linux runs, i am connected to the internet and firewalld is stop..

Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shiju JacobInfo Security ManagerCommented:

/etc/rc.local is the file  you will need to edit It is executed after all the normal system services are started, at the end of the process of switching to a multiuser runlevel. You might use it to start a custom service

copy the command with the fill binary path (check the path of the binary) and save the files

/sbin/dhclient &
/bin/service firewalls stop

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andreasSystem AdminCommented:
Its better you configure the firewall correctly so that only the ports are open to the outside you need to have open for others to access. Do not turn it off completely, as then you will expose things to the outside that are not necessary.

On how to configure the firewall it depends on which linux distribution you are using.

Its also strange that you need to run dhclient manually to get internet connectivity. Also depending oon your distro and your installed software you can configure network manager or ifup correctly so that it will start the network interface with dhcp enabled upon normal startup. Many distros have nice GUI tools to do this.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.