https://askubuntu.com/questions/6995/how-to-enable-ufw-firewall-to-allow-icmp-response
Open up the UFW before.rules config file
vi /etc/ufw/before.rules
And make sure you have these rules in it
# ok icmp codes for INPUT -A ufw-before-input -p icmp --icmp-type destination-unreachable -j ACCEPT -A ufw-before-input -p icmp --icmp-type time-exceeded -j ACCEPT -A ufw-before-input -p icmp --icmp-type parameter-problem -j ACCEPT -A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT # ok icmp code for FORWARD -A ufw-before-forward -p icmp --icmp-type destination-unreachable -j ACCEPT -A ufw-before-forward -p icmp --icmp-type time-exceeded -j ACCEPT -A ufw-before-forward -p icmp --icmp-type parameter-problem -j ACCEPT -A ufw-before-forward -p icmp --icmp-type echo-request -j ACCEPT
howto allow OUT icmp ?
Do you mean allow the Ubuntu machine to ping out? It should be able to as UFW does not block outbound request by default.