Skip to content

Linux

Adding Nameservers on Sun Solaris

This is how to add a DNS Server to Solaris Box… First of all, Open up your favourite text editor and add the name servers into /etc/resolv.conf nameserver 192.168.1.1 If you need to add more, just add another one in the next line… Following the instructions below will walk you through the process… bash-3.00# ping www.google.com ping: unknown host www.google.com bash-3.00# cat /etc/resolv.conf nameserver 192.168.1.1 bash-3.00# cd /etc/ bash-3.00# cp -p nsswitch.conf nsswitch.conf.org bash-3.00# cp -p nsswitch.dns nsswitch.conf bash-3.00# /etc/init.d/nscd stop; /etc/init.d/nscd start bash-3.00# ping www.google.com www.google.com is alive bash-3.00# As you can see, the Name Server is working!

How to add IP Address / Default Gateway on Sun Solaris

Adding IP address and default gateway is rather straight forward as long as the interface is loaded. To see whether the interface is loaded, issue the command ifconfig –a You should see something like the following… bash-3.00# ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 rtls0: flags=1000842<BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 0.0.0.0 netmask 0 ether 0:6:4f:47:76:1e In this case, we will be adding the IP address and subnet mask to rtls0 along with the default gateway. IP Address: 192.168.1.60 Subnet Mask: 255.255.255.0 Default Gateway: 192.168.1.1 Here is how its done… bash-3.00# ifconfig rtls0 192.168.1.60 netmask 255.255.255.0 up bash-3.00# route add default 192.168.1.1 add net default: gateway 192.168.1.1 bash-3.00# ping 4.2.2.2 4.2.2.2 is alive Success! We can now ping a WAN IP! and here is the new output of ifconfig -a bash-3.00# ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv 4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 rtls0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 192. Read more

How to set multiple IPs on Debian

Setting multiple IPs on Linux or in this case Debian is rather straight forward… All the network info is stored in the file /etc/network/interfaces and you just need to add the info to the file… Before making changes to this file, I recommend you check your values at least 3 times! If you have made a mistake and trying to do it from a remote location, YOU WILL LOCK YOURSELF OUT! This is a sample configuration with device eth0 having the IP address of 192.168.1.2 on a Class C Network with 192.168.1.1 as the default gateway. /etc/network/interfaces: ` /etc/network/interfaces – configuration file for ifup(8), ifdown(8) # the loopback interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 In order to add multiple IPs to the same interface, In this case eth0 You need to add it in the following method&#8230; Read more

How to gain ROOT access to a Linux Box within 10 Seconds

It is pretty easy when it comes to gaining root password to any Linux System as long as you have physical access. This is how to change Fedora’s ROOT Password. When your box starts up, You will see the GRUB screen… What you need to do is, press the a Key instead of Enter You will see something like the following… kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/ acpi=on rhgb quiet Add 1 at the end of that… So it looks like the following… kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/ acpi=on rhgb quiet 1 This will make the box boot into Runlevel 1 You simply type passwd Enter the new ROOT password and reboot the machine. Same thing goes for Any Linux System as welll… All you got to do is, add the following kernel argument… init=/bin/bash And then just change the password…

Forcing / eliminating the WWW

If you have a website and want to force www.domain.com Use the following .htaccess code <br /> RewriteEngine On<br /> RewriteCond %{HTTP_HOST} !^www\.<br /> RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]<br /> If you want to eliminate the www prefix like domain.com then use the following .htaccess code <br /> RewriteEngine On<br /> RewriteCond %{HTTP_HOST} ^www\.(.+)$<br /> RewriteRule ^(.*)$ http://%1/$1 [R=301,L]<br />

How to tar.gz

If you are in the same directory as where your files / folders are placed, then you dont have to specify the file location. i.e. /usr/home/bleh/bleh This is how to make a .tar.gz from a Folder tar czf /path/to/output/folder/filename.tar.gz /path/to/folder i.e if you are in /path/to/output/ and you want to put the file in /path/to/output/ you can use the following command. tar czf filename.tar.gz folder This is how to extract a .tar.gz file gunzip -c /path/to/folder/filename.tar.gz or like i do… tar -zxvf /path/to/folder/filename.tar.gz i.e if you are in /path/to/folder/ You can do the following… tar -zxvf filename.tar.gz View a list of all files in a .tar.gz archive gunzip -c /path/to/folder/filename.tar.gz | tar -tvf - i.e if you are in /path/to/folder/ You can do the following… gunzip -c filename.tar.gz | tar -tvf - Extract a single file from a .tar.gz file gunzip -c /path/to/folder/filename.tar.gz | tar -xvf - path/within/archive/filename. Read more

How to Build an IPFW on FreeBSD 4.x

How to Build an IPFW on FreeBSD 4.x First of all, you need to view the Current Kernel options. pico /usr/src/sys/i386/conf/GENERIC And see whether the Following lines exist options IPFIREWALL options IPFIREWALL_VERBOSE options IPFIREWALL_VERBOSE_LIMIT=100 options IPDIVERT options TCP_DROP_SYNFIN If they doesn’t exist, you need to add these options and recompile the kernel. This is how to configure and compile your kernel. cd /usr/src/sys/i386/conf cp GENERIC FWKERNEL (or whatever you want to name it to) pico FWKERNEL Add the following config options: options IPFIREWALL options IPFIREWALL_VERBOSE options IPFIREWALL_VERBOSE_LIMIT=100 options IPDIVERT options TCP_DROP_SYNFIN Save and exit. cd /usr/src make buildkernel KERNCONF=FWKERNEL make installkernel KERNCONF=FWKERNEL Now, the new Kernel should have been configured. IF YOU ARE SETTING THIS UP OVER SSH (REMOTE) DO NOT RESTART YOUR MACHNE YET, OTHERWISE YOU WILL LOCK YOURSELF OUT!!! To setup the firewall on your machine, you need to add some options onto /etc/rc. Read more