Pages

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, September 5, 2012

Custom Kernel with CentOS

     Custom kernel in CentoOS is highly unrecommended by the CentOS team. I don't know the reason. They may want you to rely on them all the day or may be because of some security issues. But Linux is not an End User Operation System. And Linux users (can be called as Hackers sometimes) don't always following rules and recommendations. Sometimes won't even read them.

     I am using CentOS-5.8, which is running Linux-2.6.18 kernel. I want to install 2.6.35 kernel in that. I downloaded the source and did make menuconfig, make and make install. Everything went well and entry has been added in /boot/grub/menu.lst. But when I was booting with that kernel, it showed an error mount: could not find filesystem like this. The solution is very simple. Just enable CONFIG_SYSFS_DEPRECATED_V2.

#make menuconfig
Set "General Setup —> enable deprecated sysfs features". Or after doing make menuconfig, open .config file and grep for CONFIG_SYSFS_DEPRECATED_V2. Then replace that line with CONFIG_SYSFS_DEPRECATED_V2=y. And now build the kernel as usual.

#make
#make modules
#make modules_install
#make install
 Reboot with the newly installed kernel.

Friday, August 31, 2012

DNS setup in BSD machine

     Earlier I have written a blog about setting up DNS server in CentOS. You can find that here. And today I was given a task to do the same in BSD machine. wtf! Even BSD is an UNIX variant, it is not Linux. So the problem it will not have much different but a little. We have find that little one. Like earlier, I didn't find any simple method to setup dns.

     The concept is same as we did in Linux. Need to install bind. Then edit named.conf. And write a database file. I am not going to explain every steps. So just spend some 10 minutes with the page I mentioned above. Of course 10 minutes is enough to finish that article.

Install bind:
     If you have connected your BSD machine with Internet, It will be much easy. I didn't connected. If you have connected,
#cd /usr/ports/dns/bind94/
#make configure
select the options you want in the menu shown. Ans click ok. Thats all you have done.

     In case you are not having Internet like me(poor guy right?), download bind-9.4-ESV.tar.gz and bind-9.4-ESV.tar.gz.asc and copy that to your BSD machine on the location /usr/ports/distfiles. Now run the above two commands. Thats all. You thought of more complex steps. You are not supposed to expect complex things from this blog. Because basically I am a somberi.

Edit named.config
     Just copy and paste the following in the file /etc/namedb/named.conf

zone "example.org" {
     type master;
     file "/etc/namedb/master/example.org.db";
};
    Change the name and file path as per your requirement. Atleast read that above mentioned article now. You can have a little understanding of this file. Anyway you wish :@

Edit database file
       Copy and paste the following /etc/namedb/master/example.org.db"
$TTL    3600
example.org.  IN  SOA  example.org  hostmaster.example.org. ( 
    200
      112000
      15000
      312000
      22000 )

example.org.  IN  NS  ns1.example.org.

ns1.example.org.  IN  A  10.0.0.1

example.org.  IN  A  10.10.10.10
one.example.org.  IN  A  5.3.3.3
six.example.org.  IN  AAAA  3fff::e
six.example.org.  IN  AAAA  fe80::10

Alter this as per you requirement. Now you have no chance. You should read that article if you want to really alter anything here.

Some touch things and start the engine
     Now open /etc/rc.conf and the line named_enable="YES" at the end.


     Set your DNS server to the local host. Open /etc/resolv.conf and add nameserver 127.0.0.1. Or the IP may be any IP you assigned to your machine. It also can be an IPv6 address.
#echo "nameserver <ip_addr>" >/etc/resolv.conf
Okey. Steps are over. start it.
#service named start
 Whatever error it throws, don't care. Just check it by doing a look-up. You want to know the command to do a look-up? Then I am so rude I won't help you.

Troubleshooting
     If it is not working, try after rebooting the machine.
     If you make any change in the configuration file or the database file, you need to restart the dns server. you can simply use #service named restart. But in my case, it doesn't work. So #killall named and once again start the dns server with #service named start
 
    And you really want more and you have time and patience, read this. I referred this page to set up DNS server in my machine and write this article ;). I said I referred not read!

Thursday, August 23, 2012

IPv6 network commands for Free BSD

I am using a Free BSD machine in my office to run some test scripts. BSD is similar to Linux but not Linux. The commands to use in BSD interface is little different from commands being used in Linux. Many times I spent hours just find the correct syntax. So here I have given some commands' syntax.


Add IPv6 address
syntax: ifconfig <interface_name> inet6 <ipv6_address>/<prefix_len>
example: ifconfig vr0 inet6 3fff::2/64
des: Assigning ipv6 address 3fff::2 with prefix length 64 to the interface vr0

Delete IPv6 address
syntax: ifconfig <interface_name> inet6 <ipv6_address>/<prefix_len> delete
example: ifconfig vr0 inet6 3fff::2/64 delete
des: Removing ipv6 address 3fff::2 with prefix length 64 from the interface vr0

Add route in routing table
syntax: route add -inet6 <subnet> <gateway>
example: route add -inet6 ::/0 fe80::2
des: Adding default route to gateway fe80::2

Remove route from routing table
syntax: route del -inet6 <subnet> <gateway>
example: route del -inet6 ::/0 fe80::2
des: Removing default route to gateway fe80::2 from routing table

Show routing table
#netstat -nr

IPv6 address look-up (nslookup for ipv6)
syntax: nslookup -q=AAAA <domain_name>
example: nslookup -q=AAAA six.example.org
des: look up for ipv6 address to the domain six.example.org

ping ipv6 address
syntax: ping6 [-I <interface>] [-c <count>] <ipv6_address or domain having ipv6_address>
example: ping6 -I vr0 fe80::4
                 ping6 -I vr0 -c 4 six.example.org
des: first line pings to the ipv6 address fe80::4 via the interface vr0. Second line pings to the domain six.example.org which is having at-least an ipv6 address via interface vr0 four times. The second line first does DNS lookup for the name six.example.org

Wednesday, August 22, 2012

simple ipv4 and ipv6 dns server setup in linux (centos)

Here I have explained the steps to setup a simple dns server for some small experiments. My operation system is CentOS. But the configuration files will be same in other operating systems also. I used bind for dns deamon. There are other options too. But bind is popular and fully documented.
  • Install bind (#yum install bind). In some case bind may be already installed by default (in my machine it is already installed).
  • The configuration file, named.conf should be placed in /etc/. If bind-chroot is installed, the configuration file should be placed in /var/named/chroot/etc/.
  • /var/named will be bind's working directory. If bind-chroot is installed /var/named/chroot will be the working directory. (place .db files in corresponding directory)
 /etc/named.conf (/var/named/chroot/etc/named.conf incase bind-chroot)
zone "example.org" {
        type master;
        file "example.org.db";
};
/etc/named/example.org.db (var/named/chroot/example.org.db incase bind-chroot)
 @       IN      SOA     example.org.    hostmaster.example.org. (
                     2008051200      ; serial
                     1d12h                ; refresh
                     15M                   ; update
                     3W12h               ; expiry
                     2h20M   )          ; minimum

  @       IN     NS      ns1.example.org.

  one     IN     A        56.89.90.2
  @       IN     A        89.89.89.89
  six     IN     AAAA     fe80::2
  six     IN     AAAA     3fff::2
  six     IN     AAAA     fec0::15
  • Replace example.org with the name you want to use.
  • In example.org.db file, the line "one IN A 56.89.90.2" matches the name one.example.org with the IPv4 address 56.89.90.2
  • The line "@ IN A 89.89.89.89" matches the name example.org('@' refers current domain) with ipv4 address 89.89.89.89
  • And the last three lines adds three AAAA IPv6 records for the name six.example.org.
Configure dns server ip address to local machine's address. Now restart the named demon (bind dns server demon)
# service named restart
Check the functioning of dns server by issuing nslookup command.

  • Resolve one.example.org
# nslookup one.example.org
Server:         10.5.1.1
Address:        10.5.1.1#53

Name:   one.example.org
Address: 56.89.90.2

  • Resolve example.org
# nslookup example.org
Server:         10.5.1.1
Address:        10.5.1.1#53

Name:   example.org
Address: 89.89.89.89

  • Reslove six.example.org (IPv6)
# nslookup
> set q=AAAA
> six.example.org
six.example.org has AAAA address fec0::15
six.example.org has AAAA address 3fff::2
six.example.org has AAAA address fe80::2
 If you want better understanding please visit http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-bind.html

Thursday, February 10, 2011

Make computer as a router

I'm doing my final year project now. For that I need to connect two different network through a router. But in my college there was no router. But I can have as many computers I need to work. So I planned to make a computer as a router. Here I used Ubuntu, a debian based linux destro to make the system to route.

First I have connected two NIC (Network Interface Card) to a computer. And I had a default NIC. That totally three NICs I had in my computer. So I can connect three different network segments together. Now connect three network segments with the computer and assign IP address for three NICs. Now enable IP forwarding in the Ubuntu machine. Restart networking. Thats all the system became router.

I just gave the outline. Now I'm going to tell what I have done in my college. I have four systems totally. One of them is added two more NICs. That system(Ub) is installed Ubuntu 10.10. And the other three have been installed with Windows XP operating system (Xp1,Xp2,Xp3). I decided three XP systems as separate network segments. I have assigned the following IP for those machines
  • Xp1 - 192.168.1.105
  • Xp2 - 10.10.3.101
  • Xp3 - 10.10.2.101
And for those three NICs in the Ubuntu system as follows
  • eth0 - 192.168.1.100
  • eth1 - 10.10.3.100
  • eth2 - 10.10.2.100
I don't have any switch or router as I have told already. So I connected systems directly. But to connect two computers, the cable should be cross connected (search in Internet for cross cable). And I have connected the systems as follows
  • Xp1 - Ub eth0
  • Xp2 - Ub eth1
  • Xp3 - Ub eth2
In the Ubuntu machine I given the IP address in GUI mode. But it didn't worked for me. I don't know why. So I have assigned the IP directly in the interfaces (/etc/network/interfaces) as above. And restarted the network using the following comment
  • $ /etc/init.d/networking stop
  • $ service networking start
Alas! I made my computer into router. Now you can ping any system from any other system.

Saturday, December 18, 2010

ubuntu 10.10

After a short period I'm returning back here. Actually I was busy about my exams and followed by my campus interviews. Now got some time. But even now I'm busy with my project. But whatever I'm here now to say I'm enjoying Ubuntu 10.10 and try to make you people happy.

A month before I downloaded it. I was somewhat away from Ubuntu after its April 09 release as I become stick with Windows 7. And another problem is that after 9.04, Ubuntu's releases never support my wireless adaptor. But now I bought my new USB modem (tata photon+). So now I came back to Ubuntu. Actually I have installed both Windows 7 and Ubuntu 10.10in my computer.

Still it doesn't support my wireless adaptor but it supports my modem. Actually this is an added feature from its early version. In Ubuntu 10.04 there is no inbuilt configuration for tata photon. We have to do it manually. But now its become easy. Just select and go. Everything becomes easy.

As like its other versions it comes with Firefox as default browser. Its fair enough for an end user like me as well as developers like Cibin. And for email client, it still depends on Evolution mail. I wonder why it doesn't go for Thunder bird. Actually I don't like Evolution. But I don't know the reason may be it is unable to delete an account once created in GUI. Also its task management is not so well. So I installed tasque for me.

Instant messaging is done here by Empathy. It works fine. I'm using it for my Gmail and Facebook chat (Please social engineering guys, don't use this information to hack me). But to login Facebook, you have to create your username for facebook. You can create your username here. With this you can login into you facebook account through Empathy.

As usual it comes with the Open office bundle and a dictionary. But that dictionary will work only while you are connected to Internet. One important thing, if you are not connected with Internet, I won't recommend Ubuntu for you. Because, it will have only things which are purely open source. So you are not even able hear you favourite songs in mp3 format. And the accessories, sound & videos, games are same. Graphics is included with Shotwell photo manager. But still I don't work with it. So don't ask anything about it.

One special thing has to be underlined is all who installed Ubuntu 10.10 are give a free Ubuntu one account. With this account you can store your files online. You can synchronise you folder with online. Upto 2GB space is freely available. For premium accounts, additional space will be provided. 

And finally a screen shot of my desktop,

Monday, September 27, 2010

Don't blame your Computer

Today I went to dad's office. There was a guy typing something and shouting "you damn old computer ate all my files...... **** ...  **** ...". He was really upset. I have no job there, I just went to give a document to my dad. I went near that guy and asked what happened. He said that the previous day, the computer never get boot. They called the technician. That damn old guy (actually not the computer) simply format the hard disk and installed a new WindowsXP (he is still two version back. So its correct to say damn old guy). So all the files he saved went to the outer space.

Not only him, most of my college friends do the same (me too, a couple of times). They think if the OS get crashed, everything has gone. And the only solution is to reinstall the OS. Its not correct actually. In Windows itself they gave an option to recover their OS, if its crashed (But most of the time it won't work. Because it is Windows). But you no need to loss your saved files. You will have to leave only the software those are installed in your computer. If you have a back-up for it, you'll never.

I hardly recommend to use more than one partition in your computer. One is for your Operating System and others, use as you wish. Store all your files, documents, songs, movies, etc in the other partition, not the one where the OS is installed. Even Windows provide My Pictures, My Movies like stuffs, don't trust. Because it is Windows. So if your OS get crashed (its common, as it is Windows), you can reinstall the OS in the old partition and the files saved in other partition are safe (even the viruses. But they won't run).

Even if you saved some data in the operating system's partition, you no need to worry. Always there is Linux to help you. Nowadays most of the Linux operating system comes as live Cd. It means you no need to install them. You can directly run them from the CD. Download such a live CD. You can write it into a CD, DVD or even in your pen drive (I'm not kidding. You can run OS from your pen drive) and boot from it. Now you can browse you hard disk and copy the required files to another media. Thats all. Now you can install your all time favorite Windows once again.

You can find link to download most of the Linux distribution here.