You are here

Risharde's Blog

Create Linux Swap File

Instructions found from DigitalOcean Tutorial

Create and Enable the Swap File
Now it’s time to create the swap file itself using the dd command :

sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k
“of=/swapfile” designates the file’s name. In this case the name is swapfile.

Subsequently we are going to prepare the swap file by creating a linux swap area:

sudo mkswap /swapfile
The results display:

Setting up swapspace version 1, size = 536866 kB
Finish up by activating the swap file:

sudo swapon /swapfile
You will then be able to see the new swap file when you view the swap summary.

swapon -s
Filename Type Size Used Priority
/swapfile file 524280 0 -1
This file will last on the server until the machine reboots. You can ensure that the swap is permanent by adding it to the fstab file.

Open up the file:

sudo nano /etc/fstab
Paste in the following line:

/swapfile swap swap defaults 0 0

Setup GRE Tunnel

lsmod

modprobe ip_gre
Now set it to start at boot.

echo "/sbin/modprobe ip_gre > /dev/null 2>&1" > /etc/sysconfig/modules/ip_gre.modules && chmod 755 /etc/sysconfig/modules/ip_gre.modules
Create ifcfg-tun0 Configuration Files
We need to create the configuration files for the GRE tunnel. These files live alongside your CentOS network device files in /etc/sysconfig/network-scripts/

grebos.centoshowtos.org

Create ifcfg-tun0 file. Please note, the internal and external interfaces must already be configured and plugged into the correct ports for each network.

vi /etc/sysconfig/network-scripts/ifcfg-tun0
The file should look like this (except your IPs will be different)

DEVICE=tun0
BOOTPROTO=none
ONBOOT=no
TYPE=GRE
PEER_OUTER_IPADDR=216.52.2.41
PEER_INNER_IPADDR=192.168.77.253
MY_INNER_IPADDR=192.168.77.254
gresea.centoshowtos.org

Create ifcfg-tun0 file where the network interface scripts are.

vi /etc/sysconfig/network-scripts/ifcfg-tun0
The file should look like this (except your IPs will be different)

DEVICE=tun0
BOOTPROTO=none
ONBOOT=no
TYPE=GRE
PEER_OUTER_IPADDR=141.136.108.122
PEER_INNER_IPADDR=192.168.77.254
MY_INNER_IPADDR=192.168.77.253
Bring tun0 interfaces online and verify
Now that we have the configuration files setup, we will need to bring up the tunnel interfaces and verify that they came online properly.

grebos.centoshowtos.org

We’ll just use the ifup command to bring up the interfaces.

ifup tun0
Now we can verify with the ifconfig command.

ifconfig tun0
gresea.centoshowtos.org

We’ll just use the ifup command to bring up the interfaces.

ifup tun0
Now we can verify with the ifconfig command.

ifconfig tun0
Test the connection
At this point the tunnel should be online, and the machines should be able to reach one another via internal IP addresses. Lets ping each other and make sure everything looks ok – make sure your firewall isn’t dropping ICMP packets if it doesn’t work.

grebos.centoshowtos.org

Ping gresea.centoshowtos.org internal address

ping 192.168.77.253
gresea.centoshowtos.org

Ping grebos.centoshowtos.org internal address

ping 192.168.77.254

TCP Forwarding to next server

These rules should work, assuming that iptables is running on server 192.168.12.87 :

#!/bin/sh

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -F
iptables -t nat -F
iptables -X

iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.12.77:80
iptables -t nat -A POSTROUTING -p tcp -d 192.168.12.77 --dport 80 -j SNAT --to-source 192.168.12.87

Possible priorities to solve health issues

1. Reduce / remove acid reflux (Possibly Probiotics and Yogurt (Yogurt is okay but it will take much more... while you can overdose on probiotics which could cause over active immune response), reduction of oily foods, reduction of pepper, reduction of MSG)
2. Reduce over indulgence of sugar. Look at food that keeps sugar at bay (perhaps cabbages? - Eating Subway related diet will help with sugar and colesterol)
3. Solve sinusitis and reoccurant lung infections (reduce sugar, reduce dust, reduce allergens from air like dust, concrete, sand etc, reduce food allergens like fish, green peppers, sulphur if you are allergic to them)
4. Possibly Vitamin B, Selenium and there's one more I can't remember. Vitamin B12 in particular seems to increase immune function but remember also that if the immune system is defective, high immunity can also cause unwanted inflammation if the immune system isn't doing it properly.
5. Exercise but this is dependent on overall health as well. If exercise is making you sick, half it and keep halfing it until you feel ok. Then gradually increase as health increases (this is based on logic).
6. Reduce weight to good level to reduce stress on body especially during sleep apnea + reducing acid reflux (a prime cause of infection issues according to research) + reducing colesterol in many cases

DNS Poisoning?

I could be wrong but the site has been up and down for the past month and it seems to be some sort of DNS poisoning that was occurring. It's very weird because nothing changed on the webserver architecture yet the DNS was simply not resolving even though I can confirm bind was answering. Anyways, we're back up and if you're the attacker, it seems I didn't care that much... :) lol

Raspberry PI 2 - Installing Iceweasel

I have been trying to install iceweasel and keep getting a error 404 when using 'apt-get install iceweasel'
So here's the fix:

sudo su
apt-get update
apt-get dist-upgrade
sync
reboot

Then after reboot
sudo su
apt-get install iceweasel

Raspberry RAM Drive for LOGS

http://www.makeuseof.com/tag/extend-life-raspberry-pis-sd-card/

Basically, you edit the /etc/fstab

tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0
tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0
tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0
tmpfs /var/run tmpfs defaults,noatime,nosuid,mode=0755,size=2m 0 0
tmpfs /var/spool/mqueue tmpfs defaults,noatime,nosuid,mode=0700,gid=12,size=30m 0 0

Save

Reboot

Pages