Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently activated 3G(UMTS) connection on my cellular network. I use Nokia S60 phone as a modem while connecting from Scientific Linux 6.

While I am able to access net pretty well, the problem is my computer gets hosted. By using ip-address in a web-browser, anyone can access my localhost (running apache), this never happens with my wireline (ADSL) connection. Furthermore, even the Shell prompt changes from:

[mach2@localhost ~]$


[mach2@XX.XX.XX.XX ~]$

where XX.XX.XX.XX is the IP of the 3G connection. The very thought of putting my machine 'in the wild' is disconcerting. How can I rectify the situation without disabling services like apache, sshd and others?

share|improve this question
please tell us first two groups of digits of the IP address – Serge Oct 14 '12 at 8:54
@serge As requested: 42.105. – WeaklyTyped Oct 14 '12 at 9:02
up vote 3 down vote accepted

As the GSM operator assigned you the public IP you should ensure that you enabled the firewall on your connection. In linux the firewall is based on netfilter(iptables). Most distributions have GUI to set it up. However, if you miss it you can set the minimal set of rules manually:

$ iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$ iptables -A INPUT -p icmp -j ACCEPT
$ iptables -A INPUT -i lo -j ACCEPT
$ iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited
$ iptables -A FORWARD -j REJECT --reject-with icmp-host-prohibited

or put the rules into /etc/sysconfig/iptables

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited

then make sure the iptables init script is started at boot:

$ chkconfig iptables on

and start it:

$ service iptables start
share|improve this answer
Top 5 Best Linux Firewalls – Ƭᴇcʜιᴇ007 Oct 14 '12 at 15:41

It's hard to answer this without any details about configuration. But when using ADSL you'll be most likely connected to a router which has a firewall(iptables) running which disallows any connections from outside. That's why one explicitly has to forward ports when one wants e.g. sshd to be visible from outside.

Using 3G it depends on the configuration of your mobile provider. Some forbid connections from outside but most don't. So you'll have to set up your iptables firewall properly to reject any incoming packets from your 3G device that are not belonging to established connections.

Your prompt (assuming you use bash) is set by the environment variable $PS1, usually the hostname is displayed. It can be set by in /etc/sysconfig/network. Depending on your configuration is possible that your hostname gets changed by DHCP when you connect to your provider. Try setting your desired hostname using in /etc/sysconfig/network-scripts/ifcfg-eth0 (change eth0 with your network device)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .