iptables -t nat -A PREROUTING -p tcp -d your_ip –dport 80 -j DNAT –to some_ip:80
iptables -nvL -t nat
Monthly Archives: November 2013
openvz enable nat for containers
vi /etc/vz/vz.conf
IPTABLES=”ipt_REJECT ipt_recent ipt_owner ipt_REDIRECT ipt_tos ipt_TOS ipt_LOG ip_conntrack
ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp”
modprobe iptable_nat
modprobe ip_nat
service vz restart
could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
yum install yum install python-devel
linux – check if newest installed kernel is loaded
cat /proc/version
Linux version 3.11.7-200.fc19.x86_64
and latest installed version:
rpm -q kernel
kernel-3.11.6-201.fc19.x86_64
kernel-3.11.7-200.fc19.x86_64
kernel-3.11.8-200.fc19.x86_64
you need reboot kernel
restart gnome panel
killall gnome-panel; gnome-panel &
turn off ssl cPanel redirection
vi /var/cpanel/cpanel.config
requiressl=0
service cpanel restart
kde restart plasma desktop
kbuildsycoca4 && kquitapp plasma-desktop && kstart plasma-desktop
bind check DNS zone configuration and syntax
named-checkzone linux4you.tk /var/named/linux4you.tk.db
centos – reload new kernel without reboot
uname -r
2.6.32-71.29.1.el6.i686
yum update kernel*
then:
yum install kexec-tools
Now we get last installed kernel version release and put it on a var:
# latestkernel=`ls -t /boot/vmlinuz-* | sed “s/\/boot\/vmlinuz-//g” | head -n1`
# echo $latestkernel
2.6.32-220.4.1.el6.i686
Now we need to load the new kernel version in memory:
kexec -l /boot/vmlinuz-${latestkernel} –initrd=/boot/initramfs-${latestkernel}.img –append=”`cat /proc/cmdline`”
realod new kernel:
kexec -e
The system will “restart without restarting”..something like a fast reboot, without performing BIOS checks
name -r
2.6.32-220.4.1.el6.i686
rsnapshot backups
Rsnapshot is an open source utility that provides incremental backups.
yum install rsnapshot
config_version 1.2 = Configuration file version
snapshot_root = Destination on where to store snapshots
cmd_cp = Path to copy command
cmd_rm = Path to remove command
cmd_rsync = Path to rsync
cmd_ssh = Path to SSH
cmd_logger = Path to shell command interface to syslog
cmd_du = Path to disk usage command
interval hourly = How many hourly backups to keep.
interval daily = How many daily backups to keep.
interval weekly = How many weekly backups to keep.
interval monthly = How many monthly backups to keep.
verbose = Self-explanatory
loglevel = Self-explanatory
logfile = Path to logfile
ssh_args = Optional SSH arguments, such as a different port (-p )
exclude_file = Path to the exclude file (will be explained in more detail)
rsync_long_args = Long arguments to pass to rsync
lockfile = Self-explanatory
backup = Full path to what to be backed up followed by relative path of placement.
backup_script = Full path to an executable script followed by relative path of placement.
Abyss Web Server
Abyss Web Server is a compact web server available for Windows, Mac OS X, and Linux operating systems.
Despite its small footprint, it supports HTTP/1.1, secure SSL/TLS connections (HTTPS), IPv6, on-the-fly HTTP compression, dynamic content generation through CGI/FastCGI scripts, ISAPI extensions, native ASP.NET, reverse proxying, eXtended Side Includes (XSSI), custom error pages, password protection, IP address control, anti-leeching, bandwidth throttling, and log rotation.
It also features an automatic antihacking system as well as a multilingual remote web management interface that makes its configuration as easy as browsing a web site.
kexec – reload new kernel without reboot
Kexec is a system call that enables you to load and boot into another kernel from the currently running kernel. This is useful for kernel developers or other people who need to reboot very quickly without waiting for the whole BIOS boot process to finish. Note that there may appear some problems and kexec may not work correctly for you because the devices won’t fully reinitiate when using this method.
yum install kexec-tools
vi /etc/systemd/system/[email protected]
[Unit]
Description=load %i kernel into the current kernel
Documentation=man:kexec(8)
DefaultDependencies=no
Before=shutdown.target umount.target final.target
[Service]
Type=oneshot
ExecStart=/usr/bin/kexec -l /boot/vmlinuz-%i –initrd=/boot/initramfs-%i.img –reuse-cmdline
[Install]
WantedBy=kexec.target
systemctl enable kexec-load@linux
systemctl kexec
If you wish to load a different kernel for the next kexec, for example linux-lts, disable the service for the current kernel and enable the one for the new kernel:
systemctl disable kexec-load@linux
systemctl enable kexec-load@linux-lts
It is also perfectly legal to invoke kexec manually:
kexec -l /boot/vmlinuz-linux –initrd=/boot/initramfs-linux.img –reuse-cmdline
exec -e
check hardware LSI RAID rebuilding status with MegaCLI
MegaCli -PDRbld -ShowProg -PhysDrv [64:0] -aALL
check hardware LSI RAID status with MegaCLI
Show status:
MegaCli -AdpAllInfo -aAll
Get physical drive info
MegaCli -PDList -aAll
Get virtual disk info
MegaCli -LDInfo -Lall -aAll
Display configuration
MegaCli -CfgDsply -aAll
Dump eventlog events to file ‘events’ and open it
MegaCli -AdpEventLog -GetEvents -f events -aAll && less events
ttcp vs iperf
You can use the Test TCP utility (TTCP) to measure TCP throughput through an IP path. In order to use it, start the receiver on one side of the path, then start the transmitter on the other side. The transmitting side sends a specified number of TCP packets to the receiving side. At the end of the test, the two sides display the number of bytes transmitted and the time elapsed for the packets to pass from one end to the other. You can then use these figures to calculate the actual throughput on the link. For general information on TTCP, refer to Network Performance Testing with TTCP .
The TTCP utility can be effective in determining the actual bit rate of a particular WAN or modem connection. However, you can also use this feature to test the connection speed between any two devices with IP connectivity between them.
Server:./ttcp -r -s -p 9999
Client: ./ttcp -s -p 9999 < /boot/vmLinuz