Posts Tagged ‘linux’

[Techy] localdomain settings in Linux Mint using DNSMasq

May 12th, 2013

If you are developing websites on Linux Mint, then you might want to set a DNS Wildcard so that anything on localdomain (*.localdomain) resolves to your machine (i.e. test.localdomain , anything.localdomain). So how can you do this?

First of all, you need to install dnsmasq “a lightweight, easy to configure DNS forwarder and DHCP server”, this can be simply done using:
sudo apt-get install dnsmasq

Now you just need to configure it. Create a file in /etc/dnsmasq.d/ using something like nano, pico, vi, emacs :

sudo nano -w /etc/dnsmasq.d/localdomain.conf

with the following settings:

address=/localdomain/127.0.0.1
listen-address=127.0.0.1

This will tell DNSMasq to setup a wildcard for everything on “localdomain” to point to 127.0.0.1 and to listen for DNS requests on 127.0.0.1. Now just restart DNSmasq:
sudo service dnsmasq restart
and you are nearly done.

You now just need to change your DNS servers in network manager. On the Linux Mint task bar, right click on the network icon and select “Edit connections” and edit the connection you are using. Select “IPv4 Settings”. If you have “Automatic (DHCP)” selected, change it to “Automatic (DHCP Addresses only)”. Then add the DNS server 127.0.0.1 and others of your choosing (such as the Google 8.8.8.8 and 8.8.4.4 ones). All should now be working!

Funny: Funny Linux Commands

March 10th, 2010

Shamelessly stolen from Frank Mash (or, as UK news organisations will probably argue, “this orphaned content found was at …”):

% cat “food in cans”
cat: can’t open food in cans

% nice man woman
No manual entry for woman.

% “How would you rate Quayle’s incompetence?
Unmatched “.

% Unmatched “.
Unmatched “.

% [Where is Jimmy Hoffa?
Missing ].

% ^How did the sex change operation go?^
Modifier failed.

% If I had a ( for every $ the Congress spent, what would I have?
Too many (‘s.

% make love
Make: Don’t know how to make love. Stop.

% sleep with me
bad character

% got a light?
No match.

% man: why did you get a divorce?
man:: Too many arguments.

% !:say, what is saccharine?
Bad substitute.

% %blow
%blow: No such job.

% \(-
(-: Command not found.

$ PATH=pretending! /usr/ucb/which sense
no sense in pretending!

$ drink matter
matter: cannot create

$ ddate
Today is Prickle-Prickle, the 69th day of Chaos in the YOLD 3176

and of course:

unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ; umount ; sleep

Some of these work, some of these don’t – it all depends on your OS version. ddate does work on Centos.

Techy: Find and replace on Linux excluding SVN folders

September 7th, 2009

Just another snippet aid to memory, this find and replace (using perl) uses Linux’s find’s “prune” syntax to “prune” the path before it to avoid doing and search and replace on .svn folders:

find -path '*/.svn' -prune -o -type f -exec /usr/bin/perl -pi -e "s/ORIGINAL/NEW/g" {} \;

cPanel: Error: Package system can not be repaired automatically

June 7th, 2009

If, like myself, you have recently upgraded the cPanel control panel system on your Red Hat Enterprise Linux 5.2 server and received the error message “Error: Package system can not be repaired automatically” when upgrading Apache, then it’s probably caused by a problem with either the RedHat Package Manager (RPM) or YUM. To fix it, first ensure that no RPM or yum updates are running:
ps auxwww | grep yum
ps auxwww | grep rpm

If any are running, find out why and kill -9 them if they are zombie processes. Now you just need to rebuild the RPM database:
rm /var/lib/rpm/__db.* -rf
rpm --rebuilddb

This process may take some time (between 1 and 30 minutes depending on your server speed and the number of packages installed). Once it’s completed, you should be able to upgrade without problems.

Internal Server – Firewall workaround needed

February 3rd, 2009

At work, we’re developing something on an internal server which is behind several firewalls and routers, but we need to allow a third party website (Paypal to be exact) to be able to connect to the web server.

It is nearly impossible for me to put this machine either on the public internet or make a hole in the firewall tables (basically, it’s behind our internal NAT providing router, which is then on a NATted firewalled building router, which is then on another NATted firewalled building providers router/VPN – and then the ISPs NATted firewalled router). As you can imagine, being behind 4 routers each with their own firewall configuration and us being unable to get the rules changes makes this a bit difficult.

However, along with the Linux based web server within our LAN, I do also have a remote Linux server with spare IPs. But how can I setup a connection so that the 3rd party can go to http://testdomain.myserver.example.com which then connects to my remote Linux server which then, somehow, connects to the LANed server.

We can make as many outbound connections on whichever ports we like from our LAN (so I can connect the LAN server to the remote server), but then how do I do the connection and how do I then forward the requests inbound?

Any ideas?

gamy-dance
%d bloggers like this: