add static route in Cantos and make sure it wont loose after reboot

1. Adding Routes

[root@localhost ~]# route add -net 10.4.3.0 netmask 255.255.255.0 gw 192.168.129.55
[root@localhost ~]#

Or

[root@localhost ~]# route add -net 10.4.2.0 netmask 255.255.255.0 dev eth0
[root@localhost ~]#

2. Show routing table

[root@localhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.129.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
10.4.3.0 192.168.129.55 255.255.255.0 UG 0 0 0 eth0
10.4.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.129.2 0.0.0.0 UG 0 0 0 eth0
[root@localhost ~]#
if you dont wanna loose, you can add above command to /etc.rc.local
or try this way
add routes in route-eth0 file
 static routes for the eth0 interface would be stored in the /etc/sysconfig/network-scripts/route-eth0 file. The route-interface file has two formats: IP command arguments and network/netmask directives.

The following is a sample route-eth0 file using the IP command arguments format. The default gateway is 192.168.0.1, interface eth0. The two static routes are for the 10.10.10.0/24 and 172.16.1.0/24 networks:

default 192.168.0.1 dev eth0
10.10.10.0/24 via 192.168.0.1 dev eth0
172.16.1.0/24 via 192.168.0.1 dev eth0

Static routes should only be configured for other subnets. The above example is not necessary, since packets going to the 10.10.10.0/24 and 172.16.1.0/24 networks will use the default gateway anyway. Below is an example of setting static routes to a different subnet, on a machine in a 192.168.0.0/24 subnet. The example machine has an eth0 interface in the 192.168.0.0/24 subnet, and an eth1 interface (10.10.10.1) in the 10.10.10.0/24 subnet:

Find out the IP address of eth0 and display IP only

 

Now you just wanted the IP address, use grep to get the IP:
$ /sbin/ifconfig eth0| grep 'inet addr:'Output:

inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0

To get IP address from use cut command:
$ /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2Output:

192.168.2.1  Bcast

Finally remove Bcast with awk
$ /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
Output:

192.168.2.1

How can i see if an ethernet interface is up/down linux centos

watch ip link show

 

ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 50:e5:49:45:3f:96 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0a:cd:20:31:4a brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0a:cd:20:30:c7 brd ff:ff:ff:ff:ff:ff

Fix: Cyrus-IMAP Logging region out of memory cirus imap

I found out that the Cyrus-IMAP’s database is flagging with errors as below:
[root@mail ~]# tail -n 100 -f /var/log/maillog
Mar 24 10:36:14 mail lmtpunix[4017]: executed
Mar 24 10:36:14 mail lmtpunix[4017]: DBERROR db4: Logging region out of memory; you may need to increase its size
Mar 24 10:36:14 mail lmtpunix[4017]: DBERROR: opening /var/lib/imap/deliver.db: Cannot allocate memory
Mar 24 10:36:14 mail lmtpunix[4017]: DBERROR: opening /var/lib/imap/deliver.db: cyrusdb error
Mar 24 10:36:14 mail lmtpunix[4017]: FATAL: lmtpd: unable to init duplicate delivery database
Mar 24 10:36:14 mail master[4664]: process 4017 exited, status 75
Mar 24 10:36:14 mail master[4664]: service lmtpunix pid 4017 in READY state: terminated abnormally
Mar 24 10:36:14 mail master[4018]: about to exec /usr/lib/cyrus-imapd/lmtpd
It turned out that the Cyrus-IMAP service runs out of log memory. So here comes the need to change the default setting and create a bigger cache and log memory regions of Cyrus-IMAP’s database as documented below.
Changing the default Logging region of Cyrus-IMAP servers database is easy.
Create a DB_CONFIG file is you have not done it yet.
[root@mail ~]# cat > /var/lib/imap/db/DB_CONFIG
set_cachesize 0 2097152 1
set_lg_regionmax 1048576
^D
Stop the cyrus-imapd server, this is very important.
[root@mail ~]# /etc/init.d/cyrus-imapd stop
Backup the database to be recovered.
[root@mail ~]# rsync -auvp /var/lib/imap/db /root/db_backup.date
Recover the database that was changed.
[root@mail ~]# db_recover -h /var/lib/imap/db
Once the command above is successfully done, we can now start the Cyrus-IMAP service.
[root@mail ~]# /etc/init.d/cyrus-imapd start
Check the new cache and memory statitics and wether the new settings are set correctly.
[root@mail ~]# db_stat -h /var/lib/imap/db -m
[root@mail ~]# db_stat -h /var/lib/imap/db -l

Shoot a few emails and check the logs how it goes. If users are no receiving emails correctly, the server is now back online. Keep monitoring until you are certain that everything is now back to normal

 

Courtesy: http://i8n1.blogspot.com/2010/03/cyrus-imap-logging-region-out-of-memory.html

WP Twitter Auto Publish Powered By : XYZScripts.com