Results 1 to 8 of 8

Thread: Enable ICMP Ping in CentOS at startup? (Lunix noob)

  1. #1
    Squeeler Vini's Avatar
    Join Date
    Jul 2003
    Location
    Sheffield
    Posts
    1,769
    Thanks
    44
    Thanked
    8 times in 8 posts

    Enable ICMP Ping in CentOS at startup? (Lunix noob)

    We got a couple of CentOS VA's running in our environment, which don't support/have ICMP Ping enabled at boot.

    Each time we reboot them, I'm having to manually login and enable Ping, by running;

    iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
    iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT


    Any ideas how I could add this to 'startup', so I can save an hour of my day each time these bounce? Surely it can't be too tricky?

  2. #2
    root Member DanceswithUnix's Avatar
    Join Date
    Jan 2006
    Location
    In the middle of a core dump
    Posts
    12,986
    Thanks
    781
    Thanked
    1,588 times in 1,343 posts
    • DanceswithUnix's system
      • Motherboard:
      • Asus X470-PRO
      • CPU:
      • 5900X
      • Memory:
      • 32GB 3200MHz ECC
      • Storage:
      • 2TB Linux, 2TB Games (Win 10)
      • Graphics card(s):
      • Asus Strix RX Vega 56
      • PSU:
      • 650W Corsair TX
      • Case:
      • Antec 300
      • Operating System:
      • Fedora 39 + Win 10 Pro 64 (yuk)
      • Monitor(s):
      • Benq XL2730Z 1440p + Iiyama 27" 1440p
      • Internet:
      • Zen 900Mb/900Mb (CityFibre FttP)

    Re: Enable ICMP Ping in CentOS at startup? (Lunix noob)

    The firewall config is probably in /etc/sysconfig/iptables

    It is a text file, I ignore the banner at the top telling you not to manually edit it and hit it with VI.
    On my Centos 6 box I have the line:

    -A INPUT -p icmp -j ACCEPT

    just above the one that accepts anything on the loopback port lo.

  3. #3
    Registered+
    Join Date
    Sep 2014
    Posts
    33
    Thanks
    4
    Thanked
    8 times in 8 posts

    Re: Enable ICMP Ping in CentOS at startup? (Lunix noob)

    been a while since i used iptables but there is a method of saving the new rules after they have been entered.
    FWIR the best method is to have a table file of extra rules eg /etc/xtrarules and add them to the interface at pre-up or depending on the config once the commands have been entered just use the command to save the rules in the rules file eg
    sudo iptables-save > /etc/rules.txt

  4. #4
    Squeeler Vini's Avatar
    Join Date
    Jul 2003
    Location
    Sheffield
    Posts
    1,769
    Thanks
    44
    Thanked
    8 times in 8 posts

    Re: Enable ICMP Ping in CentOS at startup? (Lunix noob)

    Thanks guys, I should have mentioned, I'm a Linux-tard, so DBarber, whilst your solution sounds better... I'm not entirely sure how that would be done.

    My linux skills run to VI, and I can just about fathom out how to save and quit, although remembering usually takes 30 minutes or so.

  5. #5
    root Member DanceswithUnix's Avatar
    Join Date
    Jan 2006
    Location
    In the middle of a core dump
    Posts
    12,986
    Thanks
    781
    Thanked
    1,588 times in 1,343 posts
    • DanceswithUnix's system
      • Motherboard:
      • Asus X470-PRO
      • CPU:
      • 5900X
      • Memory:
      • 32GB 3200MHz ECC
      • Storage:
      • 2TB Linux, 2TB Games (Win 10)
      • Graphics card(s):
      • Asus Strix RX Vega 56
      • PSU:
      • 650W Corsair TX
      • Case:
      • Antec 300
      • Operating System:
      • Fedora 39 + Win 10 Pro 64 (yuk)
      • Monitor(s):
      • Benq XL2730Z 1440p + Iiyama 27" 1440p
      • Internet:
      • Zen 900Mb/900Mb (CityFibre FttP)

    Re: Enable ICMP Ping in CentOS at startup? (Lunix noob)

    Quote Originally Posted by Vini View Post
    Thanks guys, I should have mentioned, I'm a Linux-tard, so DBarber, whilst your solution sounds better... I'm not entirely sure how that would be done.

    My linux skills run to VI, and I can just about fathom out how to save and quit, although remembering usually takes 30 minutes or so.
    Which version of Centos are you running?

    Configuration in Centos goes in /etc/sysconfig/* so best not to fight that, just roll with it.

  6. #6
    Squeeler Vini's Avatar
    Join Date
    Jul 2003
    Location
    Sheffield
    Posts
    1,769
    Thanks
    44
    Thanked
    8 times in 8 posts

    Re: Enable ICMP Ping in CentOS at startup? (Lunix noob)

    Bizarrely, I just configured RatticDB as per this; https://wiki.gutzmann.com/confluence...+on+CentOS+6.5

    And would you believe it, but check out the final step.


    vi /etc/sysconfig/iptables
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

    service iptables restart

  7. #7
    Splash
    Guest

    Re: Enable ICMP Ping in CentOS at startup? (Lunix noob)

    SSH and SSL? Not sure what that has to do with ICMP ping...

    http://crybit.com/iptables-rules-for-icmp/ should give you all that you need for ICMP.

    EDIT: ok, so you need to save them too. http://wiki.centos.org/HowTos/Network/IPTables should give you all you need on that front.
    Last edited by Splash; 10-10-2014 at 10:43 PM.

  8. #8
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts

    Re: Enable ICMP Ping in CentOS at startup? (Lunix noob)

    A little OP, but this is why I love(d) slackware. The file-foo was hammered into you. None of this lazy command-based settings malarky. There was a post by mercurial author Matt Mackall that explained what I mean better than I have .
    To err is human. To really foul things up ... you need a computer.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •