route add default gw 192.168.1.2 eth0
Category Archives: Linux networking
mysql get database size
SELECT table_schema AS “Database”,
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS “Size (MB)”
FROM information_schema.TABLES
GROUP BY table_schema;
lxc-start: lxccontainer.c: wait_on_daemonized_start: 754 Received container state “STOPPING” instead of “RUNNING”
It could be cause by this libvirt error: libvirtd[18329]: Failed to open file ‘/sys/class/net/vethSUT3FA/operstate’: No such file or directory
Fix:
brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.525400a97813 yes virbr0-nic
vim /var/lib/lxc/my_server/config
lxc.network.link = virbr0
lxc-start -n my_server -d
yum 28, ‘Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds’
You should try test network speed:
wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
pptp https not working
If some websites not working on pptp VPN.
What you need to do is increase the MTU on ppp0. Since you want this to occur every time a new connection is initiated you need to edit /etc/ppp/ip-up find a space in there and add ‘ifconfig ppp0 mtu 1468’ that should fix things for you.
pppd Cannot determine ethernet address for proxy ARP
sysctl -w net.ipv4.ip_forward=1
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
simple gre tunnel
ip tunnel add gre0 mode gre remote 172.168.10.25 local 192.168.233.204 ttl 255
ip link set gre0 up
ip addr add 10.10.10.1/24 dev gre0
PPTP usually use this Cisco tunneling protocol and etc.
pppd: LCP: timeout sending Config-Requests
Jan 17 04:52:57 cloudlix pppd[18873]: Connect: ppp0 <--> /dev/pts/1
Jan 17 04:53:27 cloudlix pppd[18873]: LCP: timeout sending Config-Requests
Jan 17 04:53:27 cloudlix pppd[18873]: Connection terminated.
Jan 17 04:53:27 cloudlix pppd[18873]: Modem hangup
Jan 17 04:53:27 cloudlix pppd[18873]: Exit.
This error means you local ot network firewall blocks GRE packets, so if you are using Fedora just do this:
sudo firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p gre -j ACCEPT
sudo firewall-cmd --permanent --direct --add-rule ipv6 filter INPUT 0 -p gre -j ACCEPT (if you are using IPV6)
sudo firewall-cmd --reload
Centos 6 pptp server on OpenVZ
yum list installed | grep ppt
ppp.x86_64 2.4.5-10.el6 @base
pptpd.x86_64 1.4.0-3.el6 @epel
cat /etc/pptpd.conf
option /etc/ppp/options.pptpd
logwtmp
connections 156
localip your_vpn_server_IP_address
remoteip 192.168.0.101-200
cat /etc/ppp/options.pptpd
name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
ms-dns 8.8.8.8
ms-dns 8.8.4.4
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
cat /etc/ppp/chap-secrets
vpn_username * your_client_password *
/etc/init.d/pptpd start
iptables:
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -i ppp+ -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1723 -j ACCEPT
-A INPUT -p gre -j ACCEPT
-A OUTPUT -p gre -j ACCEPT
-P PREROUTING ACCEPT
-P POSTROUTING ACCEPT
-P OUTPUT ACCEPT
-A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/conf/venet0/proxy_arp
vi /etc/ppp/ip-up.local
ifconfig ppp0 mtu 1468
MPPE should be enabled on client side.
Jan 16 07:27:17 cloudlix pptpd[2616]: CTRL: Starting call (launching pppd, opening GRE)
Jan 16 07:27:17 cloudlix pppd[2617]: Plugin /usr/lib64/pptpd/pptpd-logwtmp.so loaded.
Jan 16 07:27:17 cloudlix pppd[2617]: pppd 2.4.5 started by root, uid 0
Jan 16 07:27:17 cloudlix pppd[2617]: Using interface ppp0
Jan 16 07:27:17 cloudlix pppd[2617]: Connect: ppp0 <--> /dev/pts/1
Jan 16 07:27:17 cloudlix pppd[2617]: peer from calling number XX.80.253.XX authorized
Jan 16 07:27:17 cloudlix pppd[2617]: MPPE 128-bit stateless compression enabled
Jan 16 07:27:17 cloudlix pppd[2617]: Cannot determine ethernet address for proxy ARP
Jan 16 07:27:17 cloudlix pppd[2617]: local IP address 5.199.XX.XX
Jan 16 07:27:17 cloudlix pppd[2617]: remote IP address 192.168.0.101
Jan 16 07:28:15 cloudlix pppd[2617]: Modem hangup
Jan 16 07:28:15 cloudlix pppd[2617]: Connect time 1.0 minutes.
Jan 16 07:28:15 cloudlix pppd[2617]: Sent 2200951 bytes, received 163549 bytes.
Jan 16 07:28:15 cloudlix pppd[2617]: MPPE disabled
Jan 16 07:28:15 cloudlix pppd[2617]: Connection terminated.
Jan 16 07:28:15 cloudlix pppd[2617]: Exit.
Jan 16 07:28:15 cloudlix pptpd[2616]: CTRL: Client XX.80.253.XX control connection finished
tcpdump show get post data
Catch outgoing HTTP requests from your server, where xx.xx.xx.xx your server IP address:
tcpdump -n -s 0 -A 'src xx.xx.xx.xx and tcp dst port 80 and (tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504f5354)'
iptables limit connection rate
iptables -I INPUT -p tcp --dport 22 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP
iptables -A INPUT -p tcp --dport 80 -m state --state NEW -m limit --limit 50/minute --limit-burst 200 -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -m limit --limit 50/second --limit-burst 50 -j ACCEPT
iptables -A INPUT -j REJECT
bash: ip: command not found
yum install iproute
ipmitool get bmc ip
ipmitool lan print 1
tcpdump grep packet content
tcpdump -nnvvXSs 1514 'dst port 80' | grep -i some_host
bash: tcpkill: command not found
vim /usr/local/sbin/tcpkill
chmod +x /usr/local/sbin/tcpkill
#!/bin/bash
sudo ip route add $1/32 via 127.0.0.1
Usage: tcpkill IP_address